Subversion Repositories Kolibri OS

Rev

Rev 5363 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1546 Asper 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
1546 Asper 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
5077 clevermous 8
format PE DLL native 0.05
9
entry START
1546 Asper 10
 
2288 clevermous 11
DEBUG           equ 1
1546 Asper 12
 
2288 clevermous 13
API_VERSION     equ 0x01000100
1546 Asper 14
 
2288 clevermous 15
IRQ_REMAP       equ 0
16
IRQ_LINE        equ 0
1546 Asper 17
 
18
 
7585 dunkaist 19
;irq 0,13 unavailable
1546 Asper 20
;                   FEDCBA9876543210
7585 dunkaist 21
VALID_IRQ       equ 1101111111111110b
1546 Asper 22
 
2288 clevermous 23
CPU_FREQ        equ  2600d
1546 Asper 24
 
25
BIT0  EQU 0x00000001
26
BIT1  EQU 0x00000002
27
BIT5  EQU 0x00000020
28
BIT10 EQU 0x00000400
29
 
2288 clevermous 30
VID_Creative      equ 0x1102
1546 Asper 31
 
2288 clevermous 32
CTRL_CT0200       equ 0x0006  ; Dell OEM version (EMU10K1X)
1546 Asper 33
 
34
 
2288 clevermous 35
CODEC_MASTER_VOL_REG         equ 0x02
36
CODEC_AUX_VOL                equ 0x04 ;
37
CODEC_PCM_OUT_REG            equ 0x18 ; PCM output volume
38
CODEC_EXT_AUDIO_REG          equ 0x28 ; extended audio
1546 Asper 39
CODEC_EXT_AUDIO_CTRL_REG     equ 0x2a ; extended audio control
40
CODEC_PCM_FRONT_DACRATE_REG  equ 0x2c ; PCM out sample rate
41
CODEC_PCM_SURND_DACRATE_REG  equ 0x2e ; surround sound sample rate
42
CODEC_PCM_LFE_DACRATE_REG    equ 0x30 ; LFE sample rate
43
 
44
 
45
;EMU10K1(X) host controller registers set
46
;; common offsets
47
;; some definitions were borrowed from emu10k1 driver as they seem to be the same
48
;;**********************************************************************************************;;
49
;; PCI function 0 registers, address =  + PCIBASE0                                         ;;
50
;;**********************************************************************************************;;
51
 
2288 clevermous 52
PTR                     equ  0x00            ;; Indexed register set pointer register        ;;
53
                                                ;; NOTE: The CHANNELNUM and ADDRESS words can   ;;
54
                                                ;; be modified independently of each other.     ;;
1546 Asper 55
 
2288 clevermous 56
DATA                    equ  0x04            ;; Indexed register set data register           ;;
1546 Asper 57
 
2288 clevermous 58
IPR                     equ  0x08            ;; Global interrupt pending register            ;;
59
                                                ;; Clear pending interrupts by writing a 1 to   ;;
60
                                                ;; the relevant bits and zero to the other bits ;;
61
IPR_MIDITRANSBUFEMPTY   equ  0x00000001      ;; MIDI UART transmit buffer empty              ;;
62
IPR_MIDIRECVBUFEMPTY    equ  0x00000002      ;; MIDI UART receive buffer empty               ;;
63
IPR_CH_0_LOOP           equ  0x00000800      ;; Channel 0 loop                               ;;
64
IPR_CH_0_HALF_LOOP      equ  0x00000100      ;; Channel 0 half loop                          ;;
65
IPR_CAP_0_LOOP          equ  0x00080000      ;; Channel capture loop                         ;;
66
IPR_CAP_0_HALF_LOOP     equ  0x00010000      ;; Channel capture half loop                    ;;
1546 Asper 67
 
2288 clevermous 68
INTE                    equ  0x0c            ;; Interrupt enable register                    ;;
69
INTE_MIDITXENABLE       equ  0x00000001      ;; Enable MIDI transmit-buffer-empty interrupts ;;
70
INTE_MIDIRXENABLE       equ  0x00000002      ;; Enable MIDI receive-buffer-empty interrupts  ;;
71
INTE_CH_0_LOOP          equ  0x00000800      ;; Channel 0 loop                               ;;
72
INTE_CH_0_HALF_LOOP     equ  0x00000100      ;; Channel 0 half loop                          ;;
73
INTE_CAP_0_LOOP         equ  0x00080000      ;; Channel capture loop                         ;;
74
INTE_CAP_0_HALF_LOOP    equ  0x00010000      ;; Channel capture half loop                    ;;
1546 Asper 75
 
2288 clevermous 76
HCFG                    equ  0x14            ;; Hardware config register                     ;;
1546 Asper 77
 
2288 clevermous 78
HCFG_LOCKSOUNDCACHE     equ  0x00000008      ;; 1 = Cancel bustmaster accesses to soundcache ;;
79
                                                ;; NOTE: This should generally never be used.   ;;
80
HCFG_AUDIOENABLE        equ  0x00000001      ;; 0 = CODECs transmit zero-valued samples      ;;
81
                                                ;; Should be set to 1 when the EMU10K1 is       ;;
82
                                                ;; completely initialized.                      ;;
83
GPIO                    equ  0x18            ;; Defaults: 00001080-Analog, 00001000-SPDIF.   ;;
1546 Asper 84
 
85
 
2288 clevermous 86
AC97DATA                equ  0x1c            ;; AC97 register set data register (16 bit)     ;;
1546 Asper 87
 
2288 clevermous 88
AC97ADDRESS             equ  0x1e            ;; AC97 register set address register (8 bit)   ;;
1546 Asper 89
 
90
;;******************************************************************************************************;;
91
;; Emu10k1x pointer-offset register set, accessed through the PTR and DATA registers                    ;;
92
;;******************************************************************************************************;;
2288 clevermous 93
PLAYBACK_LIST_ADDR      equ  0x00            ;; Base DMA address of a list of pointers to each period/size ;;
94
                                                ;; One list entry: 4 bytes for DMA address,
95
                                                 ;; 4 bytes for period_size << 16.
96
                                                 ;; One list entry is 8 bytes long.
97
                                                 ;; One list entry for each period in the buffer.
98
                                                 ;;
99
PLAYBACK_LIST_SIZE      equ  0x01            ;; Size of list in bytes << 19. E.g. 8 periods -> 0x00380000  ;;
100
PLAYBACK_LIST_PTR       equ  0x02            ;; Pointer to the current period being played ;;
101
PLAYBACK_DMA_ADDR       equ  0x04            ;; Playback DMA addresss ;;
102
PLAYBACK_PERIOD_SIZE    equ  0x05            ;; Playback period size ;;
103
PLAYBACK_POINTER        equ  0x06            ;; Playback period pointer. Sample currently in DAC ;;
104
PLAYBACK_UNKNOWN1       equ  0x07
105
PLAYBACK_UNKNOWN2       equ  0x08
1546 Asper 106
 
107
;; Only one capture channel supported ;;
2288 clevermous 108
CAPTURE_DMA_ADDR        equ  0x10            ;; Capture DMA address ;;
109
CAPTURE_BUFFER_SIZE     equ  0x11            ;; Capture buffer size ;;
110
CAPTURE_POINTER         equ  0x12            ;; Capture buffer pointer. Sample currently in ADC ;;
111
CAPTURE_UNKNOWN         equ  0x13
1546 Asper 112
 
113
;; From 0x20 - 0x3f, last samples played on each channel ;;
114
 
2288 clevermous 115
TRIGGER_CHANNEL         equ  0x40            ;; Trigger channel playback                     ;;
116
TRIGGER_CHANNEL_0       equ  0x00000001      ;; Trigger channel 0                            ;;
117
TRIGGER_CHANNEL_1       equ  0x00000002      ;; Trigger channel 1                            ;;
118
TRIGGER_CHANNEL_2       equ  0x00000004      ;; Trigger channel 2                            ;;
119
TRIGGER_CAPTURE         equ  0x00000100      ;; Trigger capture channel                      ;;
1546 Asper 120
 
2288 clevermous 121
ROUTING                 equ  0x41            ;; Setup sound routing ?                        ;;
122
ROUTING_FRONT_LEFT      equ  0x00000001
123
ROUTING_FRONT_RIGHT     equ  0x00000002
124
ROUTING_REAR_LEFT       equ  0x00000004
125
ROUTING_REAR_RIGHT      equ  0x00000008
126
ROUTING_CENTER_LFE      equ  0x00010000
1546 Asper 127
 
2288 clevermous 128
SPCS0                   equ  0x42            ;; SPDIF output Channel Status 0 register       ;;
129
SPCS1                   equ  0x43            ;; SPDIF output Channel Status 1 register       ;;
130
SPCS2                   equ  0x44            ;; SPDIF output Channel Status 2 register       ;;
1546 Asper 131
 
2288 clevermous 132
SPCS_CLKACCYMASK        equ  0x30000000      ;; Clock accuracy                               ;;
133
SPCS_CLKACCY_1000PPM    equ  0x00000000      ;; 1000 parts per million                       ;;
134
SPCS_CLKACCY_50PPM      equ  0x10000000      ;; 50 parts per million                         ;;
135
SPCS_CLKACCY_VARIABLE   equ  0x20000000      ;; Variable accuracy                            ;;
136
SPCS_SAMPLERATEMASK     equ  0x0f000000      ;; Sample rate                                  ;;
137
SPCS_SAMPLERATE_44      equ  0x00000000      ;; 44.1kHz sample rate                          ;;
138
SPCS_SAMPLERATE_48      equ  0x02000000      ;; 48kHz sample rate                            ;;
139
SPCS_SAMPLERATE_32      equ  0x03000000      ;; 32kHz sample rate                            ;;
140
SPCS_CHANNELNUMMASK     equ  0x00f00000      ;; Channel number                               ;;
141
SPCS_CHANNELNUM_UNSPEC  equ  0x00000000      ;; Unspecified channel number                   ;;
142
SPCS_CHANNELNUM_LEFT    equ  0x00100000      ;; Left channel                                 ;;
143
SPCS_CHANNELNUM_RIGHT   equ  0x00200000      ;; Right channel                                ;;
144
SPCS_SOURCENUMMASK      equ  0x000f0000      ;; Source number                                ;;
145
SPCS_SOURCENUM_UNSPEC   equ  0x00000000      ;; Unspecified source number                    ;;
146
SPCS_GENERATIONSTATUS   equ  0x00008000      ;; Originality flag (see IEC-958 spec)          ;;
147
SPCS_CATEGORYCODEMASK   equ  0x00007f00      ;; Category code (see IEC-958 spec)             ;;
148
SPCS_MODEMASK           equ  0x000000c0      ;; Mode (see IEC-958 spec)                      ;;
149
SPCS_EMPHASISMASK       equ  0x00000038      ;; Emphasis                                     ;;
150
SPCS_EMPHASIS_NONE      equ  0x00000000      ;; No emphasis                                  ;;
151
SPCS_EMPHASIS_50_15     equ  0x00000008      ;; 50/15 usec 2 channel                         ;;
152
SPCS_COPYRIGHT          equ  0x00000004      ;; Copyright asserted flag -- do not modify     ;;
153
SPCS_NOTAUDIODATA       equ  0x00000002      ;; 0 = Digital audio, 1 = not audio             ;;
154
SPCS_PROFESSIONAL       equ  0x00000001      ;; 0 = Consumer (IEC-958), 1 = pro (AES3-1992)  ;;
1546 Asper 155
 
2288 clevermous 156
SPDIF_SELECT            equ  0x45            ;; Enables SPDIF or Analogue outputs 0-Analogue, 0x700-SPDIF ;;
1546 Asper 157
 
158
;; This is the MPU port on the card                                                             ;;
2288 clevermous 159
MUDATA          equ  0x47
160
MUCMD           equ  0x48
161
MUSTAT          equ  MUCMD
1546 Asper 162
 
163
;; From 0x50 - 0x5f, last samples captured ;;
164
 
165
 
2288 clevermous 166
SRV_GETVERSION        equ  0
167
DEV_PLAY              equ  1
168
DEV_STOP              equ  2
169
DEV_CALLBACK          equ  3
170
DEV_SET_BUFF          equ  4
171
DEV_NOTIFY            equ  5
1546 Asper 172
DEV_SET_MASTERVOL     equ  6
173
DEV_GET_MASTERVOL     equ  7
2288 clevermous 174
DEV_GET_INFO          equ  8
1546 Asper 175
 
2288 clevermous 176
struc AC_CNTRL              ;AC controller base class
177
{ .bus                dd ?
178
  .devfn              dd ?
1546 Asper 179
 
2288 clevermous 180
  .vendor             dd ?
181
  .dev_id             dd ?
182
  .pci_cmd            dd ?
183
  .pci_stat           dd ?
1546 Asper 184
 
185
  .codec_io_base      dd ?
186
  .codec_mem_base     dd ?
187
 
188
  .ctrl_io_base       dd ?
189
  .ctrl_mem_base      dd ?
2288 clevermous 190
  .cfg_reg            dd ?
191
  .int_line           dd ?
1546 Asper 192
 
2288 clevermous 193
  .vendor_ids         dd ?    ;vendor id string
194
  .ctrl_ids           dd ?    ;hub id string
1546 Asper 195
 
2288 clevermous 196
  .buffer             dd ?
1546 Asper 197
 
2288 clevermous 198
  .notify_pos         dd ?
199
  .notify_task        dd ?
1546 Asper 200
 
2288 clevermous 201
  .lvi_reg            dd ?
202
  .ctrl_setup         dd ?
1546 Asper 203
  .user_callback      dd ?
204
  .codec_read16       dd ?
205
  .codec_write16      dd ?
206
 
2288 clevermous 207
  .ctrl_read8         dd ?
208
  .ctrl_read16        dd ?
209
  .ctrl_read32        dd ?
1546 Asper 210
 
2288 clevermous 211
  .ctrl_write8        dd ?
1546 Asper 212
  .ctrl_write16       dd ?
213
  .ctrl_write32       dd ?
214
}
215
 
2288 clevermous 216
struc CODEC                ;Audio Chip base class
1546 Asper 217
{
2288 clevermous 218
  .chip_id            dd ?
219
  .flags              dd ?
220
  .status             dd ?
1546 Asper 221
 
222
  .ac_vendor_ids      dd ?    ;ac vendor id string
2288 clevermous 223
  .chip_ids           dd ?    ;chip model string
1546 Asper 224
 
2288 clevermous 225
  .shadow_flag        dd ?
226
                      dd ?
1546 Asper 227
 
2288 clevermous 228
  .regs               dw ?     ; codec registers
1546 Asper 229
  .reg_master_vol     dw ?     ;0x02
230
  .reg_aux_out_vol    dw ?     ;0x04
231
  .reg_mone_vol       dw ?     ;0x06
232
  .reg_master_tone    dw ?     ;0x08
233
  .reg_beep_vol       dw ?     ;0x0A
234
  .reg_phone_vol      dw ?     ;0x0C
2288 clevermous 235
  .reg_mic_vol        dw ?     ;0x0E
1546 Asper 236
  .reg_line_in_vol    dw ?     ;0x10
2288 clevermous 237
  .reg_cd_vol         dw ?     ;0x12
1546 Asper 238
  .reg_video_vol      dw ?     ;0x14
239
  .reg_aux_in_vol     dw ?     ;0x16
240
  .reg_pcm_out_vol    dw ?     ;0x18
241
  .reg_rec_select     dw ?     ;0x1A
242
  .reg_rec_gain       dw ?     ;0x1C
243
  .reg_rec_gain_mic   dw ?     ;0x1E
2288 clevermous 244
  .reg_gen            dw ?     ;0x20
245
  .reg_3d_ctrl        dw ?     ;0X22
246
  .reg_page           dw ?     ;0X24
1546 Asper 247
  .reg_powerdown      dw ?     ;0x26
248
  .reg_ext_audio      dw ?     ;0x28
2288 clevermous 249
  .reg_ext_st         dw ?     ;0x2a
1546 Asper 250
  .reg_pcm_front_rate dw ?     ;0x2c
251
  .reg_pcm_surr_rate  dw ?     ;0x2e
252
  .reg_lfe_rate       dw ?     ;0x30
253
  .reg_pcm_in_rate    dw ?     ;0x32
2288 clevermous 254
                      dw ?     ;0x34
1546 Asper 255
  .reg_cent_lfe_vol   dw ?     ;0x36
256
  .reg_surr_vol       dw ?     ;0x38
257
  .reg_spdif_ctrl     dw ?     ;0x3A
2288 clevermous 258
                      dw ?     ;0x3C
259
                      dw ?     ;0x3E
260
                      dw ?     ;0x40
261
                      dw ?     ;0x42
262
                      dw ?     ;0x44
263
                      dw ?     ;0x46
264
                      dw ?     ;0x48
265
                      dw ?     ;0x4A
266
                      dw ?     ;0x4C
267
                      dw ?     ;0x4E
268
                      dw ?     ;0x50
269
                      dw ?     ;0x52
270
                      dw ?     ;0x54
271
                      dw ?     ;0x56
272
                      dw ?     ;0x58
273
                      dw ?     ;0x5A
274
                      dw ?     ;0x5C
275
                      dw ?     ;0x5E
276
  .reg_page_0         dw ?     ;0x60
277
  .reg_page_1         dw ?     ;0x62
278
  .reg_page_2         dw ?     ;0x64
279
  .reg_page_3         dw ?     ;0x66
280
  .reg_page_4         dw ?     ;0x68
281
  .reg_page_5         dw ?     ;0x6A
282
  .reg_page_6         dw ?     ;0x6C
283
  .reg_page_7         dw ?     ;0x6E
284
                      dw ?     ;0x70
285
                      dw ?     ;0x72
286
                      dw ?     ;0x74
287
                      dw ?     ;0x76
288
                      dw ?     ;0x78
289
                      dw ?     ;0x7A
1546 Asper 290
  .reg_vendor_id_1    dw ?     ;0x7C
291
  .reg_vendor_id_2    dw ?     ;0x7E
292
 
293
 
2288 clevermous 294
  .reset              dd ?    ;virual
1546 Asper 295
  .set_master_vol     dd ?
296
}
297
 
298
struc CTRL_INFO
2288 clevermous 299
{   .pci_cmd          dd ?
300
    .irq              dd ?
1546 Asper 301
    .glob_cntrl       dd ?
2288 clevermous 302
    .glob_sta         dd ?
1546 Asper 303
    .codec_io_base    dd ?
304
    .ctrl_io_base     dd ?
305
    .codec_mem_base   dd ?
306
    .ctrl_mem_base    dd ?
2288 clevermous 307
    .codec_id         dd ?
1546 Asper 308
}
309
 
2288 clevermous 310
EVENT_NOTIFY    equ 0x00000200
1546 Asper 311
 
5077 clevermous 312
section '.flat' code readable writable executable
313
include '../struct.inc'
314
include '../macros.inc'
315
include '../proc32.inc'
316
include '../peimport.inc'
1546 Asper 317
 
318
 
5077 clevermous 319
proc START c uses ebx esi edi, state:dword, cmdline:dword
1546 Asper 320
 
2288 clevermous 321
        cmp     [state], 1
322
        jne     .stop
1546 Asper 323
 
324
     if DEBUG
2288 clevermous 325
        mov     esi, msgInit
5077 clevermous 326
        invoke  SysMsgBoardStr
1546 Asper 327
     end if
328
 
2288 clevermous 329
        call    detect_controller
330
        test    eax, eax
331
        jz      .fail
1546 Asper 332
 
333
     if DEBUG
2288 clevermous 334
        mov     esi, [ctrl.vendor_ids]
5077 clevermous 335
        invoke  SysMsgBoardStr
2288 clevermous 336
        mov     esi, [ctrl.ctrl_ids]
5077 clevermous 337
        invoke  SysMsgBoardStr
1546 Asper 338
     end if
339
 
2288 clevermous 340
        call    init_controller
341
        test    eax, eax
342
        jz      .fail
1546 Asper 343
 
2288 clevermous 344
        call    init_codec
345
        test    eax, eax
346
        jz      .fail
1546 Asper 347
 
2288 clevermous 348
        call    setup_codec
1546 Asper 349
 
2288 clevermous 350
        mov     esi, msgPrimBuff
5077 clevermous 351
        invoke  SysMsgBoardStr
2288 clevermous 352
        call    create_primary_buff
353
        mov     esi, msgDone
5077 clevermous 354
        invoke  SysMsgBoardStr
1546 Asper 355
 
356
  if IRQ_REMAP
2288 clevermous 357
        pushf
358
        cli
1546 Asper 359
 
2288 clevermous 360
        mov     ebx, [ctrl.int_line]
361
        in      al, 0xA1
362
        mov     ah, al
363
        in      al, 0x21
364
        test    ebx, ebx
365
        jz      .skip
366
        bts     ax, bx                          ;mask old line
1546 Asper 367
.skip:
2288 clevermous 368
        bts     ax, IRQ_LINE                    ;mask new ine
369
        out     0x21, al
370
        mov     al, ah
371
        out     0xA1, al
1546 Asper 372
 
2288 clevermous 373
        stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE      ;remap IRQ
1546 Asper 374
 
2288 clevermous 375
        mov     dx, 0x4d0                       ;8259 ELCR1
376
        in      al, dx
377
        bts     ax, IRQ_LINE
378
        out     dx, al                          ;set level-triggered mode
379
        mov     [ctrl.int_line], IRQ_LINE
380
        popf
381
        mov     esi, msgRemap
5077 clevermous 382
        invoke  SysMsgBoardStr
1546 Asper 383
  end if
384
 
2288 clevermous 385
        mov     eax, VALID_IRQ
386
        mov     ebx, [ctrl.int_line]
387
        mov     esi, msgInvIRQ
388
        bt      eax, ebx
389
        jnc     .fail_msg
1546 Asper 390
 
5077 clevermous 391
        invoke  AttachIntHandler, ebx, ac97_irq, dword 0
2288 clevermous 392
        stdcall create
1546 Asper 393
 
394
.reg:
5077 clevermous 395
        invoke  RegService, sz_sound_srv, service_proc
2288 clevermous 396
        ret
1546 Asper 397
.fail:
398
     if DEBUG
2288 clevermous 399
        mov     esi, msgFail
5077 clevermous 400
        invoke  SysMsgBoardStr
1546 Asper 401
     end if
2288 clevermous 402
        xor     eax, eax
403
        ret
1546 Asper 404
.fail_msg:
5077 clevermous 405
        invoke  SysMsgBoardStr
2288 clevermous 406
        xor     eax, eax
407
        ret
1546 Asper 408
.stop:
2288 clevermous 409
        call    stop
410
        xor     eax, eax
411
        ret
1546 Asper 412
endp
413
 
2288 clevermous 414
handle     equ  IOCTL.handle
415
io_code    equ  IOCTL.io_code
416
input      equ  IOCTL.input
417
inp_size   equ  IOCTL.inp_size
418
output     equ  IOCTL.output
419
out_size   equ  IOCTL.out_size
1546 Asper 420
 
421
align 4
422
proc service_proc stdcall, ioctl:dword
423
 
2288 clevermous 424
        mov     edi, [ioctl]
425
        mov     eax, [edi+io_code]
1546 Asper 426
 
2288 clevermous 427
        cmp     eax, SRV_GETVERSION
428
        jne     @F
429
        mov     eax, [edi+output]
430
        cmp     [edi+out_size], 4
431
        jne     .fail
1546 Asper 432
 
2288 clevermous 433
        mov     [eax], dword API_VERSION
434
        xor     eax, eax
435
        ret
1546 Asper 436
@@:
2288 clevermous 437
        cmp     eax, DEV_PLAY
438
        jne     @F
1546 Asper 439
     if DEBUG
2288 clevermous 440
        mov     esi, msgPlay
5077 clevermous 441
        invoke  SysMsgBoardStr
1546 Asper 442
     end if
2288 clevermous 443
        call    play
444
        ret
1546 Asper 445
@@:
2288 clevermous 446
        cmp     eax, DEV_STOP
447
        jne     @F
1546 Asper 448
     if DEBUG
2288 clevermous 449
        mov     esi, msgStop
5077 clevermous 450
        invoke  SysMsgBoardStr
1546 Asper 451
     end if
2288 clevermous 452
        call    stop
453
        ret
1546 Asper 454
@@:
2288 clevermous 455
        cmp     eax, DEV_CALLBACK
456
        jne     @F
457
        mov     ebx, [edi+input]
458
        stdcall set_callback, [ebx]
459
        ret
1546 Asper 460
@@:
2288 clevermous 461
        cmp     eax, DEV_SET_MASTERVOL
462
        jne     @F
463
        mov     eax, [edi+input]
464
        mov     eax, [eax]
465
        call    set_master_vol          ;eax= vol
466
        ret
1546 Asper 467
@@:
2288 clevermous 468
        cmp     eax, DEV_GET_MASTERVOL
469
        jne     @F
470
        mov     ebx, [edi+output]
471
        stdcall get_master_vol, ebx
472
        ret
1546 Asper 473
@@:
2288 clevermous 474
        cmp     eax, DEV_GET_INFO
475
        jne     @F
476
        mov     ebx, [edi+output]
477
        stdcall get_dev_info, ebx
478
        ret
1546 Asper 479
@@:
480
.fail:
2288 clevermous 481
        or      eax, -1
482
        ret
1546 Asper 483
endp
484
 
485
restore   handle
486
restore   io_code
487
restore   input
488
restore   inp_size
489
restore   output
490
restore   out_size
491
 
492
 
493
align 4
494
proc ac97_irq
2288 clevermous 495
           locals
496
             status dd 0
497
           endl
1546 Asper 498
 
499
;        status = inl(chip->port + IPR);
2288 clevermous 500
        mov     edx, IPR
501
        call    [ctrl.ctrl_read32]
502
        test    eax, eax
503
        jz      @f
1546 Asper 504
 
2288 clevermous 505
        mov     dword [status], eax
1546 Asper 506
 
2288 clevermous 507
        mov     ebx, dword [buff_list]
508
        cmp     [ctrl.user_callback], 0
509
        je      @f
510
        stdcall [ctrl.user_callback], ebx
1546 Asper 511
       @@:
2288 clevermous 512
        mov     eax, dword [status]               ;; ack ;;
513
        mov     edx, IPR
514
        call    [ctrl.ctrl_write32]
515
        ret
1546 Asper 516
endp
517
 
518
 
519
align 4
520
proc create_primary_buff
521
 
5077 clevermous 522
        invoke  KernelAlloc, 0x10000
2288 clevermous 523
        mov     [ctrl.buffer], eax
1546 Asper 524
 
2288 clevermous 525
        mov     edi, eax
526
        mov     ecx, 0x10000/4
527
        xor     eax, eax
528
        cld
529
        rep stosd
1546 Asper 530
 
2288 clevermous 531
        mov     eax, [ctrl.buffer]
5077 clevermous 532
        invoke  GetPgAddr
1546 Asper 533
 
2288 clevermous 534
        mov     edi, pcmout_bdl
535
        stosd
536
        mov     eax, 0x4000000
537
        stosd
1546 Asper 538
 
2288 clevermous 539
        mov     edi, buff_list
540
        mov     eax, [ctrl.buffer]
541
        stosd                        ;1.]
1546 Asper 542
 
2288 clevermous 543
        mov     eax, [ctrl.buffer]
5077 clevermous 544
        invoke  GetPgAddr
1546 Asper 545
 
2288 clevermous 546
        stdcall ptr_write, PLAYBACK_POINTER, 0, 0
547
        stdcall ptr_write, PLAYBACK_UNKNOWN1, 0, 0
548
        stdcall ptr_write, PLAYBACK_UNKNOWN2, 0, 0
549
        stdcall ptr_write, PLAYBACK_DMA_ADDR, 0, eax
1546 Asper 550
 
2288 clevermous 551
        mov     eax, pcmout_bdl
552
        mov     ebx, eax
5077 clevermous 553
        invoke  GetPgAddr
2288 clevermous 554
        and     ebx, 0xFFF
555
        add     eax, ebx
1546 Asper 556
 
2288 clevermous 557
        stdcall ptr_write, PLAYBACK_LIST_ADDR, 0, eax
558
        stdcall ptr_write, PLAYBACK_LIST_SIZE, 0, 0
559
        stdcall ptr_write, PLAYBACK_LIST_PTR, 0, 0
1546 Asper 560
 
2288 clevermous 561
           ;mov     eax, 0x00004000
562
           ;shl     eax, 16
563
        stdcall ptr_write, PLAYBACK_PERIOD_SIZE, 0, 0x40000000    ;eax
1546 Asper 564
 
2288 clevermous 565
        ret
1546 Asper 566
endp
567
 
568
 
569
align 4
570
proc detect_controller
2288 clevermous 571
           locals
572
             last_bus dd ?
573
             bus      dd ?
574
             devfn    dd ?
575
           endl
1546 Asper 576
 
2288 clevermous 577
        xor     eax, eax
578
        mov     [bus], eax
579
        inc     eax
5077 clevermous 580
        invoke  PciApi
2288 clevermous 581
        cmp     eax, -1
582
        je      .err
1546 Asper 583
 
2288 clevermous 584
        mov     [last_bus], eax
1546 Asper 585
 
586
.next_bus:
2288 clevermous 587
        and     [devfn], 0
1546 Asper 588
.next_dev:
5077 clevermous 589
        invoke  PciRead32, [bus], [devfn], dword 0
2288 clevermous 590
        test    eax, eax
591
        jz      .next
592
        cmp     eax, -1
593
        je      .next
1546 Asper 594
 
2288 clevermous 595
        mov     edi, devices
1546 Asper 596
@@:
2288 clevermous 597
        mov     ebx, [edi]
598
        test    ebx, ebx
599
        jz      .next
1546 Asper 600
 
2288 clevermous 601
        cmp     eax, ebx
602
        je      .found
603
        add     edi, 12
604
        jmp     @B
1546 Asper 605
.next:
2288 clevermous 606
        inc     [devfn]
607
        cmp     [devfn], 256
608
        jb      .next_dev
609
        mov     eax, [bus]
610
        inc     eax
611
        mov     [bus], eax
612
        cmp     eax, [last_bus]
613
        jna     .next_bus
614
        xor     eax, eax
615
        ret
1546 Asper 616
.found:
2288 clevermous 617
        mov     ebx, [bus]
618
        mov     [ctrl.bus], ebx
1546 Asper 619
 
2288 clevermous 620
        mov     ecx, [devfn]
621
        mov     [ctrl.devfn], ecx
1546 Asper 622
 
2288 clevermous 623
        mov     edx, eax
624
        and     edx, 0xFFFF
625
        mov     [ctrl.vendor], edx
626
        shr     eax, 16
627
        mov     [ctrl.dev_id], eax
1546 Asper 628
 
2288 clevermous 629
        mov     ebx, [edi+4]
630
        mov     [ctrl.ctrl_ids], ebx
631
        mov     esi, [edi+8]
632
        mov     [ctrl.ctrl_setup], esi
1546 Asper 633
 
2288 clevermous 634
        cmp     edx, VID_Creative
635
        jne     @F
636
        mov     [ctrl.vendor_ids], msg_Creative
637
        ret
1546 Asper 638
@@:
639
 
640
.err:
2288 clevermous 641
        xor     eax, eax
642
        mov     [ctrl.vendor_ids], eax    ;something  wrong ?
643
        ret
1546 Asper 644
endp
645
 
646
align 4
647
proc init_controller
648
 
5077 clevermous 649
        invoke  PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x2C
2288 clevermous 650
        mov     esi, msgPciSubsys
5077 clevermous 651
        invoke  SysMsgBoardStr
2288 clevermous 652
        call    dword2str
5077 clevermous 653
        invoke  SysMsgBoardStr
1546 Asper 654
 
5077 clevermous 655
        invoke  PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
2288 clevermous 656
        mov     ebx, eax
657
        and     eax, 0xFFFF
658
        mov     [ctrl.pci_cmd], eax
659
        shr     ebx, 16
660
        mov     [ctrl.pci_stat], ebx
1546 Asper 661
 
2288 clevermous 662
        mov     esi, msgPciCmd
5077 clevermous 663
        invoke  SysMsgBoardStr
2288 clevermous 664
        call    dword2str
5077 clevermous 665
        invoke  SysMsgBoardStr
1546 Asper 666
 
2288 clevermous 667
        mov     esi, msgPciStat
5077 clevermous 668
        invoke  SysMsgBoardStr
2288 clevermous 669
        mov     eax, [ctrl.pci_stat]
670
        call    dword2str
5077 clevermous 671
        invoke  SysMsgBoardStr
1546 Asper 672
 
2288 clevermous 673
        mov     esi, msgCtrlIsaIo
5077 clevermous 674
        invoke  SysMsgBoardStr
675
        invoke  PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
2288 clevermous 676
        call    dword2str
5077 clevermous 677
        invoke  SysMsgBoardStr
1546 Asper 678
 
2288 clevermous 679
        and     eax, 0xFFC0
680
        mov     [ctrl.ctrl_io_base], eax
1546 Asper 681
 
682
.default:
5077 clevermous 683
        invoke  PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
2288 clevermous 684
        and     eax, 0xFF
1546 Asper 685
@@:
2288 clevermous 686
        mov     [ctrl.int_line], eax
1546 Asper 687
 
2288 clevermous 688
        call    [ctrl.ctrl_setup]
689
        xor     eax, eax
690
        inc     eax
691
        ret
1546 Asper 692
endp
693
 
694
align 4
695
proc set_Creative
2288 clevermous 696
        mov     [ctrl.codec_read16], codec_io_r16         ;virtual
697
        mov     [ctrl.codec_write16], codec_io_w16        ;virtual
1546 Asper 698
 
2288 clevermous 699
        mov     [ctrl.ctrl_read8 ], ctrl_io_r8            ;virtual
700
        mov     [ctrl.ctrl_read16], ctrl_io_r16           ;virtual
701
        mov     [ctrl.ctrl_read32], ctrl_io_r32           ;virtual
1546 Asper 702
 
2288 clevermous 703
        mov     [ctrl.ctrl_write8 ], ctrl_io_w8           ;virtual
704
        mov     [ctrl.ctrl_write16], ctrl_io_w16          ;virtual
705
        mov     [ctrl.ctrl_write32], ctrl_io_w32          ;virtual
706
        ret
1546 Asper 707
endp
708
 
709
 
710
align 4
711
proc init_codec
2288 clevermous 712
        call    reset_codec
713
        test    eax, eax
714
        jz      .err
715
        call    detect_codec
716
        xor     eax, eax
717
        inc     eax
718
        ret
1546 Asper 719
     .err:
2288 clevermous 720
        xor     eax, eax
721
        ret
1546 Asper 722
endp
723
 
724
align 4
725
proc reset_codec
2288 clevermous 726
           locals
727
             counter dd ?
728
           endl
1546 Asper 729
 
730
     if DEBUG
2288 clevermous 731
        mov     esi, msgCold
5077 clevermous 732
        invoke  SysMsgBoardStr
1546 Asper 733
     end if
734
 
2288 clevermous 735
        mov     eax, 100000         ; wait 100 ms ;400000     ; wait 400 ms
736
        call    StallExec
1546 Asper 737
 
2288 clevermous 738
        stdcall ptr_read, TRIGGER_CHANNEL, 0
1546 Asper 739
 
2288 clevermous 740
        mov     [counter], 16        ; total 20*100 ms = 2s
1546 Asper 741
.wait:
2288 clevermous 742
        stdcall codec_read, dword 0x26
743
        test    eax, 1
744
        jnz     .ok
1546 Asper 745
 
2288 clevermous 746
        mov     eax, 100000        ; wait 100 ms
747
        call    StallExec
1546 Asper 748
 
2288 clevermous 749
        dec     [counter]
750
        jnz     .wait
1546 Asper 751
 
752
     if DEBUG
2288 clevermous 753
        mov     esi, msgCRFail
5077 clevermous 754
        invoke  SysMsgBoardStr
1546 Asper 755
     end if
756
 
757
.fail:
2288 clevermous 758
        stc
759
        ret
1546 Asper 760
.ok:
761
 
762
 
2288 clevermous 763
        xor     eax, eax
764
        inc     eax
765
        ret
1546 Asper 766
endp
767
 
768
 
769
align 4
770
play:
2288 clevermous 771
        mov     eax, INTE_CH_0_LOOP
772
        stdcall intr_enable, eax
1546 Asper 773
 
2288 clevermous 774
        stdcall ptr_read, TRIGGER_CHANNEL, 0
775
        mov     ebx, TRIGGER_CHANNEL_0
776
        or      eax, ebx
777
        stdcall ptr_write, TRIGGER_CHANNEL, 0, eax
1546 Asper 778
 
2288 clevermous 779
        xor     eax, eax
780
        ret
1546 Asper 781
 
782
align 4
783
stop:
2288 clevermous 784
        mov     eax, INTE_CH_0_LOOP or INTE_CH_0_HALF_LOOP
785
        stdcall intr_disable, eax
1546 Asper 786
 
2288 clevermous 787
        stdcall ptr_read, TRIGGER_CHANNEL, 0
788
        mov     ebx, TRIGGER_CHANNEL_0
789
        xor     ebx, -1
790
        or      eax, ebx
791
        stdcall ptr_write, TRIGGER_CHANNEL, 0, eax
792
        xor     eax, eax
793
        ret
1546 Asper 794
 
795
align 4
796
proc get_dev_info stdcall, p_info:dword
2288 clevermous 797
           virtual at esi
798
             CTRL_INFO CTRL_INFO
799
           end virtual
1546 Asper 800
 
2288 clevermous 801
        mov     esi, [p_info]
802
        mov     eax, [ctrl.int_line]
803
        mov     ecx, [ctrl.ctrl_io_base]
804
        mov     [CTRL_INFO.irq], eax
805
        mov     [CTRL_INFO.ctrl_io_base], ecx
806
        mov     eax, [codec.chip_id]
807
        mov     [CTRL_INFO.codec_id], eax
808
        mov     ebx, [ctrl.pci_cmd]
809
        mov     [CTRL_INFO.pci_cmd], ebx
1546 Asper 810
 
2288 clevermous 811
        xor     eax, eax
812
        mov     [CTRL_INFO.codec_io_base], eax
813
        mov     [CTRL_INFO.codec_mem_base], eax
814
        mov     [CTRL_INFO.ctrl_mem_base], eax
815
        mov     [CTRL_INFO.glob_cntrl], eax
816
        mov     [CTRL_INFO.glob_sta], eax
817
        ret
1546 Asper 818
endp
819
 
820
align 4
821
proc set_callback stdcall, handler:dword
2288 clevermous 822
        mov     eax, [handler]
823
        mov     [ctrl.user_callback], eax
824
        ret
1546 Asper 825
endp
826
 
827
 
828
align 4
829
proc create stdcall
5077 clevermous 830
        invoke  PciRead16, [ctrl.bus], [ctrl.devfn], 4
2288 clevermous 831
        test    eax, 4     ; test master bit
832
        jnz     @f
833
        or      eax, 4
5077 clevermous 834
        invoke  PciWrite16, [ctrl.bus], [ctrl.devfn], 4, eax     ; set master bit
2288 clevermous 835
         @@:
1546 Asper 836
 
2288 clevermous 837
        xor     eax, eax
838
        mov     edx, INTE
839
        call    [ctrl.ctrl_write32]
1546 Asper 840
 
2288 clevermous 841
        stdcall ptr_write, SPCS0, 0, \
842
                SPCS_CLKACCY_1000PPM or SPCS_SAMPLERATE_48 or \
843
                SPCS_CHANNELNUM_LEFT or SPCS_SOURCENUM_UNSPEC or \
844
                SPCS_GENERATIONSTATUS or 0x00001200 or \
845
                0x00000000 or SPCS_EMPHASIS_NONE or SPCS_COPYRIGHT
846
        stdcall ptr_write, SPCS1, 0, \
847
                SPCS_CLKACCY_1000PPM or SPCS_SAMPLERATE_48 or \
848
                SPCS_CHANNELNUM_LEFT or SPCS_SOURCENUM_UNSPEC or \
849
                SPCS_GENERATIONSTATUS or 0x00001200 or \
850
                0x00000000 or SPCS_EMPHASIS_NONE or SPCS_COPYRIGHT
851
        stdcall ptr_write, SPCS2, 0, \
852
                SPCS_CLKACCY_1000PPM or SPCS_SAMPLERATE_48 or \
853
                SPCS_CHANNELNUM_LEFT or SPCS_SOURCENUM_UNSPEC or \
854
                SPCS_GENERATIONSTATUS or 0x00001200 or \
855
                0x00000000 or SPCS_EMPHASIS_NONE or SPCS_COPYRIGHT
1546 Asper 856
 
2288 clevermous 857
        stdcall ptr_write, SPDIF_SELECT, 0, 0x700      ; disable SPDIF
858
        stdcall ptr_write, ROUTING, 0, 0x1003F         ; routing
859
        stdcall gpio_write, 0x1080                     ; analog mode
1546 Asper 860
 
2288 clevermous 861
        mov     eax, dword HCFG_LOCKSOUNDCACHE or HCFG_AUDIOENABLE
862
        mov     edx, HCFG
863
        call    [ctrl.ctrl_write32]
864
        ret
1546 Asper 865
endp
866
 
867
align 4
868
proc codec_read stdcall, reg:dword
2288 clevermous 869
        stdcall ac97_read, dword [reg]
870
        ret
1546 Asper 871
endp
872
 
873
 
874
align 4
875
proc codec_write stdcall, reg:dword
2288 clevermous 876
        stdcall ac97_write, dword [reg], eax
877
        ret
1546 Asper 878
endp
879
 
880
 
881
align 4
882
proc ac97_read stdcall, reg:dword
2288 clevermous 883
        push    edx
884
        mov     eax, dword [reg]
885
        mov     edx, AC97ADDRESS
886
        call    [ctrl.ctrl_write8]
1546 Asper 887
 
2288 clevermous 888
        mov     edx, AC97DATA
889
        call    [ctrl.ctrl_read16]
890
        and     eax, 0xFFFF
891
        pop     edx
892
        ret
1546 Asper 893
endp
894
 
895
align 4
896
proc ac97_write stdcall, reg:dword, val:dword
2288 clevermous 897
        push    eax edx
898
        mov     eax, dword [reg]
899
        mov     edx, AC97ADDRESS
900
        call    [ctrl.ctrl_write8]
1546 Asper 901
 
2288 clevermous 902
        mov     eax, dword [val]
903
        mov     edx, AC97DATA
904
        call    [ctrl.ctrl_write16]
905
        pop     edx eax
906
        ret
1546 Asper 907
endp
908
 
909
align 4
910
proc ptr_read stdcall, reg:dword, chn:dword
2288 clevermous 911
        push    edx
912
        mov     eax, dword [reg]
913
        shl     eax, 16
914
        or      eax, dword [chn]
1546 Asper 915
 
2288 clevermous 916
        mov     edx, PTR
917
        call    [ctrl.ctrl_write32]
1546 Asper 918
 
2288 clevermous 919
        mov     edx, DATA
920
        call    [ctrl.ctrl_read32]
921
        pop     edx
922
        ret
1546 Asper 923
endp
924
 
925
align 4
926
proc ptr_write stdcall, reg:dword, chn:dword, data:dword
2288 clevermous 927
        push    eax edx
928
        mov     eax, dword [reg]
929
        shl     eax, 16
930
        or      eax, dword [chn]
1546 Asper 931
 
2288 clevermous 932
        mov     edx, PTR
933
        call    [ctrl.ctrl_write32]
1546 Asper 934
 
2288 clevermous 935
        mov     eax, dword [data]
936
        mov     edx, DATA
937
        call    [ctrl.ctrl_write32]
938
        pop     edx eax
939
        ret
1546 Asper 940
endp
941
 
942
align 4
943
proc intr_enable stdcall, intrenb:dword
2288 clevermous 944
        push    edx
945
        mov     edx, INTE
946
        call    [ctrl.ctrl_read32]
1546 Asper 947
 
2288 clevermous 948
        or      eax, dword [intrenb]
949
        mov     edx, INTE
950
        call    [ctrl.ctrl_write32]
951
        pop     edx
952
        ret
1546 Asper 953
endp
954
 
955
align 4
956
proc intr_disable stdcall, intrenb:dword
2288 clevermous 957
        push    eax ebx edx
958
        mov     edx, INTE
959
        call    [ctrl.ctrl_read32]
1546 Asper 960
 
2288 clevermous 961
        mov     ebx, dword [intrenb]
962
        xor     ebx, -1
963
        and     eax, ebx
964
        mov     edx, INTE
965
        call    [ctrl.ctrl_write32]
966
        pop     edx ebx eax
967
        ret
1546 Asper 968
endp
969
 
970
align 4
971
proc gpio_write stdcall, value:dword
2288 clevermous 972
        push    eax edx
973
        mov     eax, dword [value]
974
        mov     edx, GPIO
975
        call    [ctrl.ctrl_write32]
976
        pop     edx eax
977
        ret
1546 Asper 978
endp
979
 
980
 
981
align 4
982
proc StallExec
2288 clevermous 983
        push    ecx
984
        push    edx
985
        push    ebx
986
        push    eax
1546 Asper 987
 
2288 clevermous 988
        mov     ecx, CPU_FREQ
989
        mul     ecx
990
        mov     ebx, eax           ;low
991
        mov     ecx, edx           ;high
992
        rdtsc
993
        add     ebx, eax
994
        adc     ecx, edx
1546 Asper 995
@@:
2288 clevermous 996
        rdtsc
997
        sub     eax, ebx
998
        sbb     edx, ecx
999
        js      @B
1546 Asper 1000
 
2288 clevermous 1001
        pop     eax
1002
        pop     ebx
1003
        pop     edx
1004
        pop     ecx
1005
        ret
1546 Asper 1006
endp
1007
 
1008
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1009
;          CONTROLLER IO functions
1010
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1011
 
1012
align 4
1013
proc codec_io_r16 ;Not used.
2288 clevermous 1014
           ;mov      edx, [ctrl.ctrl_io_base]
1015
           ;in       eax, dx
1016
        ret
1546 Asper 1017
endp
1018
 
1019
align 4
1020
proc codec_io_w16 ;Not used.
2288 clevermous 1021
           ;mov      edx, [ctrl.ctrl_io_base]
1022
           ;out      dx,  eax
1023
        ret
1546 Asper 1024
endp
1025
 
1026
align 4
1027
proc ctrl_io_r8
2288 clevermous 1028
        add     edx, [ctrl.ctrl_io_base]
1029
        in      al, dx
1030
        ret
1546 Asper 1031
endp
1032
 
1033
align 4
1034
proc ctrl_io_r16
2288 clevermous 1035
        add     edx, [ctrl.ctrl_io_base]
1036
        in      ax, dx
1037
        ret
1546 Asper 1038
endp
1039
 
1040
align 4
1041
proc ctrl_io_r32
2288 clevermous 1042
        add     edx, [ctrl.ctrl_io_base]
1043
        in      eax, dx
1044
        ret
1546 Asper 1045
endp
1046
 
1047
align 4
1048
proc ctrl_io_w8
2288 clevermous 1049
        add     edx, [ctrl.ctrl_io_base]
1050
        out     dx, al
1051
        ret
1546 Asper 1052
endp
1053
 
1054
align 4
1055
proc ctrl_io_w16
2288 clevermous 1056
        add     edx, [ctrl.ctrl_io_base]
1057
        out     dx, ax
1058
        ret
1546 Asper 1059
endp
1060
 
1061
align 4
1062
proc ctrl_io_w32
2288 clevermous 1063
        add     edx, [ctrl.ctrl_io_base]
1064
        out     dx, eax
1065
        ret
1546 Asper 1066
endp
1067
 
1068
 
1069
align 4
1070
dword2str:
2288 clevermous 1071
        push    eax ebx ecx
1072
        mov     esi, hex_buff
1073
        mov     ecx, -8
1546 Asper 1074
   @@:
2288 clevermous 1075
        rol     eax, 4
1076
        mov     ebx, eax
1077
        and     ebx, 0x0F
1078
        mov     bl, [ebx+hexletters]
1079
        mov     [8+esi+ecx], bl
1080
        inc     ecx
1081
        jnz     @B
1082
        pop     ecx ebx eax
1083
        ret
1546 Asper 1084
 
1085
hexletters   db '0123456789ABCDEF'
1086
hex_buff     db 8 dup(0),13,10,0
1087
 
1088
 
1089
include "codec.inc"
1090
 
1091
align 4
1092
devices dd (CTRL_CT0200 shl 16)+VID_Creative,msg_CT_EMU10K1X,set_Creative
2288 clevermous 1093
        dd 0    ;terminator
1546 Asper 1094
 
1095
 
1096
msg_CT_EMU10K1X  db 'SB Live! Dell OEM', 13,10, 0
2288 clevermous 1097
msg_Creative     db 'Creative ', 0
1546 Asper 1098
 
2288 clevermous 1099
szKernel            db 'KERNEL', 0
1100
sz_sound_srv        db 'SOUND',0
1546 Asper 1101
 
1102
msgInit      db 'detect hardware...',13,10,0
1103
msgFail      db 'device not found',13,10,0
1104
msgInvIRQ    db 'IRQ line not assigned or invalid', 13,10, 0
1105
msgPlay      db 'start play', 13,10,0
1106
msgStop      db 'stop play',  13,10,0
2288 clevermous 1107
msgIRQ       db 'AC97 IRQ', 13,10,0
1546 Asper 1108
;msgInitCtrl  db 'init controller',13,10,0
1109
;msgInitCodec db 'init codec',13,10,0
1110
msgPrimBuff  db 'create primary buffer ...',0
1111
msgDone      db 'done',13,10,0
1112
msgRemap     db 'Remap IRQ',13,10,0
1113
;msgReg       db 'set service handler',13,10,0
1114
;msgOk        db 'service installed',13,10,0
1115
msgCold      db 'cold reset',13,10,0
1116
;msgWarm      db 'warm reset',13,10,0
1117
;msgWRFail    db 'warm reset failed',13,10,0
1118
msgCRFail    db 'cold reset failed',13,10,0
1119
;msgCFail     db 'codec not ready',13,10,0
1120
;msgCInvalid  db 'codec is not valid',13,10,0 ;Asper
1121
;msgResetOk   db 'reset complete',13,10,0
1122
;msgStatus    db 'global status   ',0
1123
;msgControl   db 'global control  ',0
1124
msgPciCmd    db 'PCI command     ',0
1125
msgPciStat   db 'PCI status      ',0
1126
msgPciSubsys db 'PCI subsystem   ',0
1127
msgCtrlIsaIo db 'controller io base   ',0
1128
;msgMixIsaIo  db 'codec io base        ',0
1129
;msgCtrlMMIo  db 'controller mmio base ',0
1130
;msgMixMMIo   db 'codec mmio base      ',0
1131
;msgIrqMap    db 'AC97 irq map as      ',0
1132
 
5077 clevermous 1133
align 4
1134
data fixups
1135
end data
1546 Asper 1136
 
5077 clevermous 1137
align 8
2288 clevermous 1138
pcmout_bdl       rq 32
1139
buff_list        rd 32
1546 Asper 1140
 
1141
codec CODEC
1142
ctrl AC_CNTRL