Subversion Repositories Kolibri OS

Rev

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

Rev 465 Rev 774
Line 107... Line 107...
107
DEV_SET_MASTERVOL     equ  6
107
DEV_SET_MASTERVOL     equ  6
108
DEV_GET_MASTERVOL     equ  7
108
DEV_GET_MASTERVOL     equ  7
109
DEV_GET_INFO	      equ  8
109
DEV_GET_INFO	      equ  8
Line 110... Line 110...
110
 
110
 
111
struc AC_CNTRL		    ;AC controller base class
111
struc AC_CNTRL		    ;AC controller base class
112
{ .bus                dd ?
112
{ .bus		      dd ?
Line 113... Line 113...
113
  .devfn              dd ?
113
  .devfn	      dd ?
114
 
114
 
115
  .vendor             dd ?
115
  .vendor	      dd ?
116
  .dev_id             dd ?
116
  .dev_id	      dd ?
Line 117... Line 117...
117
  .pci_cmd            dd ?
117
  .pci_cmd	      dd ?
118
  .pci_stat           dd ?
118
  .pci_stat	      dd ?
Line 119... Line 119...
119
 
119
 
120
  .codec_io_base      dd ?
120
  .codec_io_base      dd ?
121
  .codec_mem_base     dd ?
121
  .codec_mem_base     dd ?
122
 
122
 
Line 123... Line 123...
123
  .ctrl_io_base       dd ?
123
  .ctrl_io_base       dd ?
124
  .ctrl_mem_base      dd ?
124
  .ctrl_mem_base      dd ?
Line 125... Line 125...
125
  .cfg_reg            dd ?
125
  .cfg_reg	      dd ?
Line 126... Line 126...
126
  .int_line           dd ?
126
  .int_line	      dd ?
127
 
127
 
Line 128... Line 128...
128
  .vendor_ids         dd ?    ;vendor id string
128
  .vendor_ids	      dd ?    ;vendor id string
129
  .ctrl_ids           dd ?    ;hub id string
129
  .ctrl_ids	      dd ?    ;hub id string
130
 
130
 
131
  .buffer             dd ?
131
  .buffer	      dd ?
132
 
132
 
Line 133... Line 133...
133
  .notify_pos         dd ?
133
  .notify_pos	      dd ?
134
  .notify_task        dd ?
134
  .notify_task	      dd ?
135
 
135
 
Line 136... Line 136...
136
  .lvi_reg            dd ?
136
  .lvi_reg	      dd ?
137
  .ctrl_setup         dd ?
137
  .ctrl_setup	      dd ?
138
  .user_callback      dd ?
138
  .user_callback      dd ?
139
  .codec_read16       dd ?
139
  .codec_read16       dd ?
Line 140... Line 140...
140
  .codec_write16      dd ?
140
  .codec_write16      dd ?
141
 
141
 
142
  .ctrl_read8         dd ?
142
  .ctrl_read8	      dd ?
143
  .ctrl_read16        dd ?
143
  .ctrl_read16	      dd ?
144
  .ctrl_read32        dd ?
144
  .ctrl_read32	      dd ?
Line 145... Line 145...
145
 
145
 
146
  .ctrl_write8        dd ?
146
  .ctrl_write8	      dd ?
Line 147... Line 147...
147
  .ctrl_write16       dd ?
147
  .ctrl_write16       dd ?
148
  .ctrl_write32       dd ?
148
  .ctrl_write32       dd ?
Line 149... Line 149...
149
}
149
}
150
 
150
 
151
struc CODEC		   ;Audio Chip base class
151
struc CODEC		   ;Audio Chip base class
152
{
152
{
153
  .chip_id            dd ?
153
  .chip_id	      dd ?
154
  .flags              dd ?
154
  .flags	      dd ?
155
  .status             dd ?
155
  .status	      dd ?
156
 
156
 
157
  .ac_vendor_ids      dd ?    ;ac vendor id string
157
  .ac_vendor_ids      dd ?    ;ac vendor id string
158
  .chip_ids           dd ?    ;chip model string
158
  .chip_ids	      dd ?    ;chip model string
159
 
159
 
160
  .shadow_flag        dd ?
160
  .shadow_flag	      dd ?
161
                      dd ?
161
		      dd ?
162
 
162
 
163
  .regs               dw ?     ; codec registers
163
  .regs 	      dw ?     ; codec registers
164
  .reg_master_vol     dw ?     ;0x02
164
  .reg_master_vol     dw ?     ;0x02
165
  .reg_aux_out_vol    dw ?     ;0x04
165
  .reg_aux_out_vol    dw ?     ;0x04
166
  .reg_mone_vol       dw ?     ;0x06
166
  .reg_mone_vol       dw ?     ;0x06
167
  .reg_master_tone    dw ?     ;0x08
167
  .reg_master_tone    dw ?     ;0x08
168
  .reg_beep_vol       dw ?     ;0x0A
168
  .reg_beep_vol       dw ?     ;0x0A
169
  .reg_phone_vol      dw ?     ;0x0C
169
  .reg_phone_vol      dw ?     ;0x0C
170
  .reg_mic_vol        dw ?     ;0x0E
170
  .reg_mic_vol	      dw ?     ;0x0E
171
  .reg_line_in_vol    dw ?     ;0x10
171
  .reg_line_in_vol    dw ?     ;0x10
172
  .reg_cd_vol         dw ?     ;0x12
172
  .reg_cd_vol	      dw ?     ;0x12
173
  .reg_video_vol      dw ?     ;0x14
173
  .reg_video_vol      dw ?     ;0x14
174
  .reg_aux_in_vol     dw ?     ;0x16
174
  .reg_aux_in_vol     dw ?     ;0x16
175
  .reg_pcm_out_vol    dw ?     ;0x18
175
  .reg_pcm_out_vol    dw ?     ;0x18
176
  .reg_rec_select     dw ?     ;0x1A
176
  .reg_rec_select     dw ?     ;0x1A
177
  .reg_rec_gain       dw ?     ;0x1C
177
  .reg_rec_gain       dw ?     ;0x1C
178
  .reg_rec_gain_mic   dw ?     ;0x1E
178
  .reg_rec_gain_mic   dw ?     ;0x1E
179
  .reg_gen            dw ?     ;0x20
179
  .reg_gen	      dw ?     ;0x20
180
  .reg_3d_ctrl        dw ?     ;0X22
180
  .reg_3d_ctrl	      dw ?     ;0X22
181
  .reg_page           dw ?     ;0X24
181
  .reg_page	      dw ?     ;0X24
182
  .reg_powerdown      dw ?     ;0x26
182
  .reg_powerdown      dw ?     ;0x26
183
  .reg_ext_audio      dw ?     ;0x28
183
  .reg_ext_audio      dw ?     ;0x28
184
  .reg_ext_st         dw ?     ;0x2a
184
  .reg_ext_st	      dw ?     ;0x2a
185
  .reg_pcm_front_rate dw ?     ;0x2c
185
  .reg_pcm_front_rate dw ?     ;0x2c
186
  .reg_pcm_surr_rate  dw ?     ;0x2e
186
  .reg_pcm_surr_rate  dw ?     ;0x2e
187
  .reg_lfe_rate       dw ?     ;0x30
187
  .reg_lfe_rate       dw ?     ;0x30
188
  .reg_pcm_in_rate    dw ?     ;0x32
188
  .reg_pcm_in_rate    dw ?     ;0x32
189
                      dw ?     ;0x34
189
		      dw ?     ;0x34
190
  .reg_cent_lfe_vol   dw ?     ;0x36
190
  .reg_cent_lfe_vol   dw ?     ;0x36
191
  .reg_surr_vol       dw ?     ;0x38
191
  .reg_surr_vol       dw ?     ;0x38
192
  .reg_spdif_ctrl     dw ?     ;0x3A
192
  .reg_spdif_ctrl     dw ?     ;0x3A
193
                      dw ?     ;0x3C
193
		      dw ?     ;0x3C
194
                      dw ?     ;0x3E
194
		      dw ?     ;0x3E
195
                      dw ?     ;0x40
195
		      dw ?     ;0x40
196
                      dw ?     ;0x42
196
		      dw ?     ;0x42
197
                      dw ?     ;0x44
197
		      dw ?     ;0x44
198
                      dw ?     ;0x46
198
		      dw ?     ;0x46
199
                      dw ?     ;0x48
199
		      dw ?     ;0x48
200
                      dw ?     ;0x4A
200
		      dw ?     ;0x4A
201
                      dw ?     ;0x4C
201
		      dw ?     ;0x4C
202
                      dw ?     ;0x4E
202
		      dw ?     ;0x4E
203
                      dw ?     ;0x50
203
		      dw ?     ;0x50
204
                      dw ?     ;0x52
204
		      dw ?     ;0x52
205
                      dw ?     ;0x54
205
		      dw ?     ;0x54
206
                      dw ?     ;0x56
206
		      dw ?     ;0x56
207
                      dw ?     ;0x58
207
		      dw ?     ;0x58
208
                      dw ?     ;0x5A
208
		      dw ?     ;0x5A
209
                      dw ?     ;0x5C
209
		      dw ?     ;0x5C
210
                      dw ?     ;0x5E
210
		      dw ?     ;0x5E
211
  .reg_page_0         dw ?     ;0x60
211
  .reg_page_0	      dw ?     ;0x60
212
  .reg_page_1         dw ?     ;0x62
212
  .reg_page_1	      dw ?     ;0x62
Line 213... Line 213...
213
  .reg_page_2         dw ?     ;0x64
213
  .reg_page_2	      dw ?     ;0x64
214
  .reg_page_3         dw ?     ;0x66
214
  .reg_page_3	      dw ?     ;0x66
215
  .reg_page_4         dw ?     ;0x68
215
  .reg_page_4	      dw ?     ;0x68
Line 216... Line 216...
216
  .reg_page_5         dw ?     ;0x6A
216
  .reg_page_5	      dw ?     ;0x6A
217
  .reg_page_6         dw ?     ;0x6C
217
  .reg_page_6	      dw ?     ;0x6C
Line 237... Line 237...
237
    .glob_sta	    dd	?
237
    .glob_sta	    dd	?
238
    .codec_io_base  dd	?
238
    .codec_io_base  dd	?
239
    .ctrl_io_base   dd	?
239
    .ctrl_io_base   dd	?
240
    .codec_mem_base dd	?
240
    .codec_mem_base dd	?
241
    .ctrl_mem_base  dd	?
241
    .ctrl_mem_base  dd	?
242
    .codec_id       dd  ?
242
    .codec_id	    dd	?
243
}
243
}
Line 244... Line 244...
244
 
244
 
245
struc IOCTL
245
struc IOCTL
246
{  .handle           dd ?
246
{  .handle	     dd ?
247
   .io_code          dd ?
247
   .io_code	     dd ?
248
   .input            dd ?
248
   .input	     dd ?
249
   .inp_size         dd ?
249
   .inp_size	     dd ?
250
   .output           dd ?
250
   .output	     dd ?
251
   .out_size         dd ?
251
   .out_size	     dd ?
Line 252... Line 252...
252
}
252
}
253
 
253
 
254
virtual at 0
254
virtual at 0
Line 255... Line 255...
255
  IOCTL IOCTL
255
  IOCTL IOCTL
Line 256... Line 256...
256
end virtual
256
end virtual
257
 
257
 
258
EVENT_NOTIFY	      equ 0x00000200
258
EVENT_NOTIFY	      equ 0x00000200
Line 259... Line 259...
259
 
259
 
260
OS_BASE         equ 0x80000000
260
OS_BASE 	equ 0x80000000
261
SLOT_BASE       equ OS_BASE+0x0080000
261
SLOT_BASE	equ OS_BASE+0x0080000
Line 262... Line 262...
262
new_app_base    equ 0
262
new_app_base	equ 0
Line 263... Line 263...
263
 
263
 
Line 264... Line 264...
264
public START
264
public START
265
public service_proc
265
public service_proc
Line 266... Line 266...
266
public version
266
public version
267
 
267
 
268
section '.flat' code readable align 16
268
section '.flat' code readable align 16
269
 
269
 
Line 270... Line 270...
270
proc START stdcall, state:dword
270
proc START stdcall, state:dword
271
 
271
 
272
           cmp [state], 1
272
	   cmp [state], 1
Line 273... Line 273...
273
           jne .stop
273
	   jne .stop
274
 
274
 
275
     if DEBUG
275
     if DEBUG
276
           mov esi, msgDetect
276
	   mov esi, msgDetect
277
           call SysMsgBoardStr
277
	   call SysMsgBoardStr
Line 278... Line 278...
278
     end if
278
     end if
279
 
279
 
280
           call detect_controller
280
	   call detect_controller
281
           test eax, eax
281
	   test eax, eax
Line 282... Line 282...
282
           jz .fail
282
	   jz .fail
Line 283... Line 283...
283
 
283
 
284
     if DEBUG
284
     if DEBUG
285
           mov esi,[ctrl.vendor_ids]
285
	   mov esi,[ctrl.vendor_ids]
286
           call SysMsgBoardStr
286
	   call SysMsgBoardStr
Line 287... Line 287...
287
           mov   esi, [ctrl.ctrl_ids]
287
	   mov	 esi, [ctrl.ctrl_ids]
288
           call SysMsgBoardStr
288
	   call SysMsgBoardStr
289
 
289
 
Line 290... Line 290...
290
     end if
290
     end if
291
           call init_controller
291
	   call init_controller
292
           test eax, eax
292
	   test eax, eax
Line 293... Line 293...
293
           jz .fail
293
	   jz .fail
294
 
294
 
295
           jmp .fail      ;force fail
295
	   jmp .fail	  ;force fail
Line 296... Line 296...
296
 
296
 
297
     if DEBUG
297
     if DEBUG
Line 298... Line 298...
298
           mov esi, msgInitCodec
298
	   mov esi, msgInitCodec
299
           call SysMsgBoardStr
299
	   call SysMsgBoardStr
Line 300... Line 300...
300
     end if
300
     end if
Line 301... Line 301...
301
 
301
 
302
           call init_codec
302
	   call init_codec
303
           test eax, eax
303
	   test eax, eax
304
           jz .fail
304
	   jz .fail
305
 
305
 
306
     if DEBUG
306
     if DEBUG
307
           mov esi, [codec.ac_vendor_ids]
307
	   mov esi, [codec.ac_vendor_ids]
308
           call SysMsgBoardStr
308
	   call SysMsgBoardStr
309
 
309
 
Line 310... Line 310...
310
           mov esi, [codec.chip_ids]
310
	   mov esi, [codec.chip_ids]
311
           call SysMsgBoardStr
311
	   call SysMsgBoardStr
312
     end if
312
     end if
313
 
313
 
314
           call reset_controller
314
	   call reset_controller
315
           call setup_codec
315
	   call setup_codec
316
 
316
 
317
           mov esi, msgPrimBuff
317
	   mov esi, msgPrimBuff
318
           call SysMsgBoardStr
318
	   call SysMsgBoardStr
319
 
319
 
320
           call create_primary_buff
320
	   call create_primary_buff
321
 
321
 
322
           mov eax, VALID_IRQ
322
	   mov eax, VALID_IRQ
323
           mov ebx, [ctrl.int_line]
323
	   mov ebx, [ctrl.int_line]
324
           mov esi, msgInvIRQ
324
	   mov esi, msgInvIRQ
Line 325... Line 325...
325
           bt eax, ebx
325
	   bt eax, ebx
326
           jnc .fail
326
	   jnc .fail
327
           mov eax, ATTCH_IRQ
327
	   mov eax, ATTCH_IRQ
328
           mov esi, msgAttchIRQ
328
	   mov esi, msgAttchIRQ
329
           bt eax, ebx
329
	   bt eax, ebx
330
           jnc .fail
330
	   jnc .fail
Line 331... Line 331...
331
 
331
 
332
           stdcall AttachIntHandler, ebx, ac97_irq
332
	   stdcall AttachIntHandler, ebx, ac97_irq, dword 0
Line 333... Line 333...
333
           stdcall RegService, sz_sound_srv, service_proc
333
	   stdcall RegService, sz_sound_srv, service_proc
334
	   ret
334
	   ret
335
.fail:
335
.fail:
336
     if DEBUG
336
     if DEBUG
337
           mov esi, msgFail
337
	   mov esi, msgFail
338
           call SysMsgBoardStr
338
	   call SysMsgBoardStr
339
     end if
339
     end if
340
           xor eax, eax
340
	   xor eax, eax
341
           ret
341
	   ret
342
.stop:
342
.stop:
343
           call stop
343
	   call stop
344
           xor eax, eax
344
	   xor eax, eax
345
           ret
345
	   ret
346
endp
346
endp
347
 
347
 
348
handle     equ  IOCTL.handle
348
handle	   equ	IOCTL.handle
349
io_code    equ  IOCTL.io_code
349
io_code    equ	IOCTL.io_code
350
input      equ  IOCTL.input
350
input	   equ	IOCTL.input
351
inp_size   equ  IOCTL.inp_size
351
inp_size   equ	IOCTL.inp_size
352
output     equ  IOCTL.output
352
output	   equ	IOCTL.output
353
out_size   equ  IOCTL.out_size
353
out_size   equ	IOCTL.out_size
354
 
354
 
355
align 4
355
align 4
356
proc service_proc stdcall, ioctl:dword
356
proc service_proc stdcall, ioctl:dword
357
 
357
 
358
           mov edi, [ioctl]
358
	   mov edi, [ioctl]
359
           mov eax, [edi+io_code]
359
	   mov eax, [edi+io_code]
360
           cmp eax, DEV_PLAY
360
	   cmp eax, DEV_PLAY
361
           jne @F
361
	   jne @F
362
     if DEBUG
362
     if DEBUG
363
           mov esi, msgPlay
363
	   mov esi, msgPlay
364
           call SysMsgBoardStr
364
	   call SysMsgBoardStr
365
     end if
365
     end if
366
           call play
366
	   call play
367
           ret
367
	   ret
368
@@:
368
@@:
369
           cmp eax, DEV_STOP
369
	   cmp eax, DEV_STOP
370
           jne @F
370
	   jne @F
371
     if DEBUG
371
     if DEBUG
372
           mov esi, msgStop
372
	   mov esi, msgStop
373
           call SysMsgBoardStr
373
	   call SysMsgBoardStr
374
     end if
374
     end if
375
           call stop
375
	   call stop
376
           ret
376
	   ret
377
@@:
377
@@:
378
           cmp eax, DEV_CALLBACK
378
	   cmp eax, DEV_CALLBACK
379
           jne @F
379
	   jne @F
380
           mov ebx, [edi+input]
380
	   mov ebx, [edi+input]
381
           stdcall set_callback, [ebx]
381
	   stdcall set_callback, [ebx]
Line 382... Line 382...
382
           ret
382
	   ret
383
@@:
383
@@:
384
           cmp eax, DEV_SET_MASTERVOL
384
	   cmp eax, DEV_SET_MASTERVOL
Line 420... Line 420...
420
;           mov esi, msgIRQ
420
;           mov esi, msgIRQ
421
;           call SysMsgBoardStr
421
;           call SysMsgBoardStr
422
;     end if
422
;     end if
Line 423... Line 423...
423
 
423
 
424
 
424
 
Line 425... Line 425...
425
           cmp [ctrl.user_callback], 0
425
	   cmp [ctrl.user_callback], 0
426
           je @f
426
	   je @f
427
 
427
 
Line 428... Line 428...
428
           stdcall [ctrl.user_callback], ebx
428
	   stdcall [ctrl.user_callback], ebx
429
@@:
429
@@:
430
           ret
430
	   ret
431
 
431
 
432
.skip:
432
.skip:
433
           mov edx, PCM_OUT_CR_REG
433
	   mov edx, PCM_OUT_CR_REG
Line 434... Line 434...
434
           mov ax, 0x11               ;0x1D
434
	   mov ax, 0x11 	      ;0x1D
435
           call [ctrl.ctrl_write8]
435
	   call [ctrl.ctrl_write8]
Line 436... Line 436...
436
           ret
436
	   ret
437
endp
437
endp
-
 
438
 
-
 
439
align 4
-
 
440
proc create_primary_buff
-
 
441
 
-
 
442
	   stdcall KernelAlloc, 0x10000
-
 
443
	   mov [ctrl.buffer], eax
-
 
444
 
-
 
445
	   mov edi, eax
-
 
446
	   mov ecx, 0x10000/4
Line 438... Line -...
438
 
-
 
439
align 4
-
 
440
proc create_primary_buff
-
 
441
 
-
 
442
           stdcall KernelAlloc, 0x10000
-
 
443
           mov [ctrl.buffer], eax
-
 
444
 
-
 
445
           mov edi, eax
-
 
446
           mov ecx, 0x10000/4
-
 
447
           xor eax, eax
447
	   xor eax, eax
448
           cld
448
	   cld
449
           rep stosd
449
	   rep stosd
450
 
450
 
451
           mov eax, [ctrl.buffer]
451
	   mov eax, [ctrl.buffer]
452
           call GetPgAddr
452
	   call GetPgAddr
Line 453... Line 453...
453
 
453
 
454
           mov ebx, 0xC0002000
454
	   mov ebx, 0xC0002000
Line 455... Line 455...
455
           mov ecx, 4
455
	   mov ecx, 4
456
           mov edi, pcmout_bdl
456
	   mov edi, pcmout_bdl
Line 457... Line 457...
457
@@:
457
@@:
458
           mov [edi], eax
458
	   mov [edi], eax
Line 459... Line 459...
459
           mov [edi+4], ebx
459
	   mov [edi+4], ebx
460
 
460
 
Line 461... Line 461...
461
           mov [edi+32], eax
461
	   mov [edi+32], eax
462
           mov [edi+4+32], ebx
462
	   mov [edi+4+32], ebx
Line 463... Line 463...
463
 
463
 
464
           mov [edi+64], eax
464
	   mov [edi+64], eax
Line 465... Line 465...
465
           mov [edi+4+64], ebx
465
	   mov [edi+4+64], ebx
466
 
466
 
Line 467... Line 467...
467
           mov [edi+96], eax
467
	   mov [edi+96], eax
468
           mov [edi+4+96], ebx
468
	   mov [edi+4+96], ebx
469
 
469
 
Line 470... Line 470...
470
           mov [edi+128], eax
470
	   mov [edi+128], eax
471
           mov [edi+4+128], ebx
471
	   mov [edi+4+128], ebx
472
 
472
 
473
           mov [edi+160], eax
473
	   mov [edi+160], eax
474
           mov [edi+4+160], ebx
474
	   mov [edi+4+160], ebx
475
 
475
 
476
           mov [edi+192], eax
476
	   mov [edi+192], eax
477
           mov [edi+4+192], ebx
477
	   mov [edi+4+192], ebx
478
 
478
 
479
           mov [edi+224], eax
479
	   mov [edi+224], eax
480
           mov [edi+4+224], ebx
480
	   mov [edi+4+224], ebx
481
 
481
 
482
           add eax, 0x4000
482
	   add eax, 0x4000
483
           add edi, 8
483
	   add edi, 8
484
           loop @B
484
	   loop @B
485
 
485
 
486
           mov edi, buff_list
486
	   mov edi, buff_list
487
           mov eax, [ctrl.buffer]
487
	   mov eax, [ctrl.buffer]
488
           mov ecx, 4
488
	   mov ecx, 4
489
@@:
489
@@:
490
           mov [edi], eax
490
	   mov [edi], eax
491
           mov [edi+16], eax
491
	   mov [edi+16], eax
492
           mov [edi+32], eax
492
	   mov [edi+32], eax
493
           mov [edi+48], eax
493
	   mov [edi+48], eax
494
           mov [edi+64], eax
494
	   mov [edi+64], eax
495
           mov [edi+80], eax
495
	   mov [edi+80], eax
496
           mov [edi+96], eax
496
	   mov [edi+96], eax
497
           mov [edi+112], eax
497
	   mov [edi+112], eax
498
 
498
 
499
           add eax, 0x4000
499
	   add eax, 0x4000
500
           add edi, 4
500
	   add edi, 4
501
           loop @B
501
	   loop @B
Line 502... Line 502...
502
 
502
 
503
           mov eax, pcmout_bdl
503
	   mov eax, pcmout_bdl
504
           mov ebx, eax
504
	   mov ebx, eax
505
           call GetPgAddr     ;eax
505
	   call GetPgAddr     ;eax
506
           and ebx, 0xFFF
506
	   and ebx, 0xFFF
507
           add eax, ebx
507
	   add eax, ebx
508
 
508
 
509
           mov edx, PCM_OUT_BDL
509
	   mov edx, PCM_OUT_BDL
510
           call [ctrl.ctrl_write32]
510
	   call [ctrl.ctrl_write32]
511
 
511
 
512
           mov eax, 16
512
	   mov eax, 16
513
           mov [ctrl.lvi_reg], eax
513
	   mov [ctrl.lvi_reg], eax
514
           mov edx, PCM_OUT_LVI_REG
514
	   mov edx, PCM_OUT_LVI_REG
515
           call [ctrl.ctrl_write8]
515
	   call [ctrl.ctrl_write8]
Line 516... Line 516...
516
           ret
516
	   ret
Line 517... Line 517...
517
endp
517
endp
518
 
518
 
519
align 4
519
align 4
520
proc detect_controller
520
proc detect_controller
521
         locals
521
	 locals
522
           last_bus dd ?
522
	   last_bus dd ?
523
           bus      dd ?
523
	   bus	    dd ?
524
           devfn    dd ?
524
	   devfn    dd ?
Line 525... Line 525...
525
         endl
525
	 endl
526
 
526
 
527
           xor eax, eax
527
	   xor eax, eax
528
           mov [bus], eax
528
	   mov [bus], eax
529
           inc eax
529
	   inc eax
530
           call PciApi
530
	   call PciApi
531
           cmp eax, -1
531
	   cmp eax, -1
532
           je .err
532
	   je .err
533
 
533
 
534
           mov [last_bus], eax
534
	   mov [last_bus], eax
Line 535... Line 535...
535
 
535
 
536
.next_bus:
536
.next_bus:
537
           and [devfn], 0
537
	   and [devfn], 0
538
.next_dev:
538
.next_dev:
539
           stdcall PciRead32, [bus], [devfn], dword 0
539
	   stdcall PciRead32, [bus], [devfn], dword 0
540
           test eax, eax
540
	   test eax, eax
541
           jz .next
541
	   jz .next
542
           cmp eax, -1
542
	   cmp eax, -1
543
           je .next
543
	   je .next
544
 
544
 
545
           mov edi, devices
545
	   mov edi, devices
546
@@:
546
@@:
547
           mov ebx, [edi]
547
	   mov ebx, [edi]
548
           test ebx, ebx
548
	   test ebx, ebx
Line 549... Line 549...
549
           jz .next
549
	   jz .next
550
 
550
 
Line 551... Line 551...
551
           cmp eax, ebx
551
	   cmp eax, ebx
552
           je .found
552
	   je .found
553
           add edi, 12
553
	   add edi, 12
554
           jmp @B
554
	   jmp @B
555
 
555
 
556
.next:
556
.next:
557
           inc [devfn]
557
	   inc [devfn]
558
           cmp [devfn], 256
558
	   cmp [devfn], 256
559
           jb  .next_dev
559
	   jb  .next_dev
560
           mov eax, [bus]
560
	   mov eax, [bus]
561
           inc eax
561
	   inc eax
562
           mov [bus], eax
562
	   mov [bus], eax
563
           cmp eax, [last_bus]
563
	   cmp eax, [last_bus]
564
           jna .next_bus
564
	   jna .next_bus
565
           xor eax, eax
565
	   xor eax, eax
566
           ret
566
	   ret
567
.found:
567
.found:
568
           mov ebx, [bus]
568
	   mov ebx, [bus]
569
           mov [ctrl.bus], ebx
569
	   mov [ctrl.bus], ebx
570
 
570
 
571
           mov ecx, [devfn]
571
	   mov ecx, [devfn]
572
           mov [ctrl.devfn], ecx
572
	   mov [ctrl.devfn], ecx
Line 573... Line 573...
573
 
573
 
574
           mov edx, eax
574
	   mov edx, eax
Line 575... Line 575...
575
           and edx, 0xFFFF
575
	   and edx, 0xFFFF
576
           mov [ctrl.vendor], edx
576
	   mov [ctrl.vendor], edx
Line 577... Line 577...
577
           shr eax, 16
577
	   shr eax, 16
578
           mov [ctrl.dev_id], eax
578
	   mov [ctrl.dev_id], eax
579
 
579
 
580
           mov ebx, [edi+4]
580
	   mov ebx, [edi+4]
581
           mov [ctrl.ctrl_ids], ebx
581
	   mov [ctrl.ctrl_ids], ebx
582
           mov esi, [edi+8]
582
	   mov esi, [edi+8]
Line 583... Line 583...
583
           mov [ctrl.ctrl_setup], esi
583
	   mov [ctrl.ctrl_setup], esi
584
 
584
 
Line 585... Line 585...
585
           cmp ebx, 0x1274
585
	   cmp ebx, 0x1274
586
           jne @F
586
	   jne @F
Line 587... Line 587...
587
           mov [ctrl.vendor_ids], msgEnsoniq
587
	   mov [ctrl.vendor_ids], msgEnsoniq
588
           ret
588
	   ret
589
@@:
589
@@:
Line 590... Line 590...
590
           mov [ctrl.vendor_ids], 0     ;something  wrong ?
590
	   mov [ctrl.vendor_ids], 0	;something  wrong ?
591
           ret
591
	   ret
Line 592... Line 592...
592
.err:
592
.err:
593
           xor eax, eax
593
	   xor eax, eax
Line 594... Line 594...
594
           ret
594
	   ret
595
endp
595
endp
596
 
596
 
Line 597... Line 597...
597
align 4
597
align 4
598
proc init_controller
598
proc init_controller
Line 599... Line 599...
599
 
599
 
600
           mov esi, msgPCIcmd
600
	   mov esi, msgPCIcmd
601
           call SysMsgBoardStr
601
	   call SysMsgBoardStr
602
 
602
 
603
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
603
	   stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
Line 604... Line 604...
604
           mov ebx, eax
604
	   mov ebx, eax
605
           and eax, 0xFFFF
605
	   and eax, 0xFFFF
606
           mov [ctrl.pci_cmd], eax
606
	   mov [ctrl.pci_cmd], eax
607
           shr ebx, 16
607
	   shr ebx, 16
Line 608... Line 608...
608
           mov [ctrl.pci_stat], ebx
608
	   mov [ctrl.pci_stat], ebx
609
 
609
 
610
           call dword2str
610
	   call dword2str
611
           call SysMsgBoardStr
611
	   call SysMsgBoardStr
612
 
612
 
613
           mov esi, msgIObase
613
	   mov esi, msgIObase
614
           call SysMsgBoardStr
614
	   call SysMsgBoardStr
615
 
615
 
616
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
616
	   stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
Line 617... Line 617...
617
;           and eax, -16
617
;           and eax, -16
618
           mov [ctrl.ctrl_io_base], eax
618
	   mov [ctrl.ctrl_io_base], eax
Line 619... Line 619...
619
 
619
 
620
           call dword2str
620
	   call dword2str
621
           call SysMsgBoardStr
621
	   call SysMsgBoardStr
622
 
622
 
623
           mov esi, msgIRQline
623
	   mov esi, msgIRQline
624
           call SysMsgBoardStr
624
	   call SysMsgBoardStr
625
 
625
 
626
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
626
	   stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
627
           and eax, 0xFF
627
	   and eax, 0xFF
628
           mov [ctrl.int_line], eax
628
	   mov [ctrl.int_line], eax
629
 
629
 
630
           call dword2str
630
	   call dword2str
631
           call SysMsgBoardStr
631
	   call SysMsgBoardStr
632
 
632
 
633
           call [ctrl.ctrl_setup]
633
	   call [ctrl.ctrl_setup]
634
           xor eax, eax
634
	   xor eax, eax
635
           inc eax
635
	   inc eax
636
           ret
636
	   ret
637
endp
637
endp
638
 
638
 
639
align 4
639
align 4
Line 640... Line 640...
640
proc set_ICH
640
proc set_ICH
641
           mov [ctrl.codec_read16],  codec_io_r16    ;virtual
641
	   mov [ctrl.codec_read16],  codec_io_r16    ;virtual
642
           mov [ctrl.codec_write16], codec_io_w16    ;virtual
642
	   mov [ctrl.codec_write16], codec_io_w16    ;virtual
643
 
643
 
644
           mov [ctrl.ctrl_read8 ],  ctrl_io_r8      ;virtual
644
	   mov [ctrl.ctrl_read8 ],  ctrl_io_r8	    ;virtual
Line 645... Line 645...
645
           mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
645
	   mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
646
           mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
646
	   mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
Line 647... Line 647...
647
 
647
 
648
           mov [ctrl.ctrl_write8 ], ctrl_io_w8      ;virtual
648
	   mov [ctrl.ctrl_write8 ], ctrl_io_w8	    ;virtual
649
           mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
649
	   mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
650
           mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
650
	   mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
Line 651... Line 651...
651
           ret
651
	   ret
652
endp
652
endp
Line 653... Line 653...
653
 
653
 
654
align 4
654
align 4
Line 655... Line 655...
655
proc reset_controller
655
proc reset_controller
656
 
656
 
Line 657... Line 657...
657
           xor eax, eax
657
	   xor eax, eax
658
           mov edx, PCM_IN_CR_REG
658
	   mov edx, PCM_IN_CR_REG
Line 659... Line 659...
659
           call [ctrl.ctrl_write8]
659
	   call [ctrl.ctrl_write8]
660
 
660
 
661
           mov edx, PCM_OUT_CR_REG
661
	   mov edx, PCM_OUT_CR_REG
Line 662... Line 662...
662
           call [ctrl.ctrl_write8]
662
	   call [ctrl.ctrl_write8]
663
 
663
 
Line 664... Line 664...
664
           mov edx, MC_IN_CR_REG
664
	   mov edx, MC_IN_CR_REG
665
           call [ctrl.ctrl_write8]
665
	   call [ctrl.ctrl_write8]
666
 
666
 
Line 667... Line 667...
667
           mov eax, RR
667
	   mov eax, RR
668
           mov edx, PCM_IN_CR_REG
668
	   mov edx, PCM_IN_CR_REG
669
           call [ctrl.ctrl_write8]
669
	   call [ctrl.ctrl_write8]
670
 
670
 
671
           mov edx, PCM_OUT_CR_REG
671
	   mov edx, PCM_OUT_CR_REG
672
           call [ctrl.ctrl_write8]
672
	   call [ctrl.ctrl_write8]
673
 
673
 
674
           mov edx, MC_IN_CR_REG
674
	   mov edx, MC_IN_CR_REG
675
           call [ctrl.ctrl_write8]
675
	   call [ctrl.ctrl_write8]
676
           ret
676
	   ret
677
endp
677
endp
678
 
678
 
679
align 4
679
align 4
680
proc init_codec
680
proc init_codec
681
         locals
681
	 locals
682
           counter dd ?
682
	   counter dd ?
683
         endl
683
	 endl
Line 684... Line 684...
684
 
684
 
685
           mov esi, msgControl
685
	   mov esi, msgControl
686
           call SysMsgBoardStr
686
	   call SysMsgBoardStr
687
 
687
 
Line 688... Line 688...
688
           mov edx, GLOB_CTRL
688
	   mov edx, GLOB_CTRL
689
           call [ctrl.ctrl_read32]
689
	   call [ctrl.ctrl_read32]
690
           call dword2str
690
	   call dword2str
691
           call SysMsgBoardStr
691
	   call SysMsgBoardStr
Line 692... Line 692...
692
 
692
 
693
           mov esi, msgStatus
693
	   mov esi, msgStatus
Line 694... Line 694...
694
           call SysMsgBoardStr
694
	   call SysMsgBoardStr
695
 
695
 
696
           mov edx, CTRL_STAT
696
	   mov edx, CTRL_STAT
697
           call [ctrl.ctrl_read32]
697
	   call [ctrl.ctrl_read32]
698
 
698
 
Line 699... Line 699...
699
           call dword2str
699
	   call dword2str
700
           call SysMsgBoardStr
700
	   call SysMsgBoardStr
701
 
701
 
702
           test eax, CTRL_ST_CREADY
702
	   test eax, CTRL_ST_CREADY
703
           jnz .ready
703
	   jnz .ready
704
 
704
 
705
           call reset_codec
705
	   call reset_codec
706
           and eax, eax
706
	   and eax, eax
707
           jz .err
707
	   jz .err
708
 
708
 
709
           xor edx, edx     ;ac_reg_0
709
	   xor edx, edx     ;ac_reg_0
Line 710... Line 710...
710
           call [ctrl.codec_write16]
710
	   call [ctrl.codec_write16]
711
 
711
 
712
           xor eax, eax
712
	   xor eax, eax
713
           mov edx, CODEC_REG_POWERDOWN
713
	   mov edx, CODEC_REG_POWERDOWN
Line 714... Line 714...
714
           call [ctrl.codec_write16]
714
	   call [ctrl.codec_write16]
715
 
715
 
716
           mov [counter], 200     ; total 200*5 ms = 1s
716
	   mov [counter], 200	  ; total 200*5 ms = 1s
Line 777... Line 777...
777
	   mov edx, GLOB_CTRL
777
	   mov edx, GLOB_CTRL
778
	   call [ctrl.ctrl_write32]
778
	   call [ctrl.ctrl_write32]
Line 779... Line 779...
779
 
779
 
780
     if DEBUG
780
     if DEBUG
781
	   mov esi, msgWarm
781
	   mov esi, msgWarm
782
           call SysMsgBoardStr
782
	   call SysMsgBoardStr
Line 783... Line 783...
783
     end if
783
     end if
784
 
784
 
785
	   mov [counter], 10	   ; total 10*100 ms = 1s
785
	   mov [counter], 10	   ; total 10*100 ms = 1s
Line 794... Line 794...
794
	   sub [counter], 1
794
	   sub [counter], 1
795
	   jnz .wait
795
	   jnz .wait
Line 796... Line 796...
796
 
796
 
797
     if DEBUG
797
     if DEBUG
798
	   mov esi, msgWRFail
798
	   mov esi, msgWRFail
799
           call SysMsgBoardStr
799
	   call SysMsgBoardStr
Line 800... Line 800...
800
     end if
800
     end if
801
 
801
 
802
	   stc
802
	   stc
803
	   ret
803
	   ret
804
.ok:
804
.ok:
805
	   mov edx, CTRL_STAT
805
	   mov edx, CTRL_STAT
806
	   call [ctrl.ctrl_read32]
806
	   call [ctrl.ctrl_read32]
807
	   and eax, CTRL_ST_CREADY
807
	   and eax, CTRL_ST_CREADY
808
           jz .fail
808
	   jz .fail
809
           clc
809
	   clc
810
	   ret
810
	   ret
811
.fail:
811
.fail:
812
           stc
812
	   stc
Line 813... Line 813...
813
	   ret
813
	   ret
814
endp
814
endp
Line 823... Line 823...
823
	   mov edx, GLOB_CTRL
823
	   mov edx, GLOB_CTRL
824
	   call [ctrl.ctrl_write32]
824
	   call [ctrl.ctrl_write32]
Line 825... Line 825...
825
 
825
 
826
     if DEBUG
826
     if DEBUG
827
	   mov esi, msgCold
827
	   mov esi, msgCold
828
           call SysMsgBoardStr
828
	   call SysMsgBoardStr
Line 829... Line 829...
829
     end if
829
     end if
830
 
830
 
Line 847... Line 847...
847
	   sub [counter], 1
847
	   sub [counter], 1
848
	   jnz .wait
848
	   jnz .wait
Line 849... Line 849...
849
 
849
 
850
     if DEBUG
850
     if DEBUG
851
	   mov esi, msgCRFail
851
	   mov esi, msgCRFail
852
           call SysMsgBoardStr
852
	   call SysMsgBoardStr
853
     end if
853
     end if
854
	   stc
854
	   stc
855
	   ret
855
	   ret
856
.ok:
856
.ok:
857
	   mov edx, CTRL_STAT
857
	   mov edx, CTRL_STAT
858
	   call [ctrl.ctrl_read32]
858
	   call [ctrl.ctrl_read32]
859
	   and eax, CTRL_ST_CREADY
859
	   and eax, CTRL_ST_CREADY
860
           jz .fail
860
	   jz .fail
861
           clc
861
	   clc
862
	   ret
862
	   ret
863
.fail:
863
.fail:
864
           stc
864
	   stc
865
	   ret
865
	   ret
Line 866... Line 866...
866
endp
866
endp
867
 
867
 
868
align 4
868
align 4
869
play:
869
play:
870
           mov eax, 16
870
	   mov eax, 16
871
           mov [ctrl.lvi_reg], eax
871
	   mov [ctrl.lvi_reg], eax
872
           mov edx, PCM_OUT_LVI_REG
872
	   mov edx, PCM_OUT_LVI_REG
873
           call [ctrl.ctrl_write8]
873
	   call [ctrl.ctrl_write8]
874
 
874
 
875
           mov edx, PCM_OUT_CR_REG
875
	   mov edx, PCM_OUT_CR_REG
876
           mov ax, 0x1D
876
	   mov ax, 0x1D
877
           call [ctrl.ctrl_write8]
877
	   call [ctrl.ctrl_write8]
Line 878... Line 878...
878
           xor eax, eax
878
	   xor eax, eax
879
           ret
879
	   ret
880
 
880
 
881
align 4
881
align 4
882
stop:
882
stop:
883
           mov edx, PCM_OUT_CR_REG
883
	   mov edx, PCM_OUT_CR_REG
884
           mov ax, 0x0
884
	   mov ax, 0x0
885
           call [ctrl.ctrl_write8]
885
	   call [ctrl.ctrl_write8]
886
 
886
 
887
           mov ax, 0x1c
887
	   mov ax, 0x1c
888
           mov edx, PCM_OUT_SR_REG
888
	   mov edx, PCM_OUT_SR_REG
Line 889... Line 889...
889
           call [ctrl.ctrl_write16]
889
	   call [ctrl.ctrl_write16]
890
           xor eax, eax
890
	   xor eax, eax
891
	   ret
891
	   ret
Line 907... Line 907...
907
	   mov [CTRL_INFO.codec_io_base], ebx
907
	   mov [CTRL_INFO.codec_io_base], ebx
908
	   mov [CTRL_INFO.ctrl_io_base], ecx
908
	   mov [CTRL_INFO.ctrl_io_base], ecx
909
	   mov [CTRL_INFO.codec_mem_base], edx
909
	   mov [CTRL_INFO.codec_mem_base], edx
910
	   mov [CTRL_INFO.ctrl_mem_base], edi
910
	   mov [CTRL_INFO.ctrl_mem_base], edi
Line 911... Line 911...
911
 
911
 
912
           mov eax, [codec.chip_id]
912
	   mov eax, [codec.chip_id]
Line 913... Line 913...
913
           mov [CTRL_INFO.codec_id], eax
913
	   mov [CTRL_INFO.codec_id], eax
914
 
914
 
915
	   mov edx, GLOB_CTRL
915
	   mov edx, GLOB_CTRL
Line 916... Line 916...
916
           call [ctrl.ctrl_read32]
916
	   call [ctrl.ctrl_read32]
917
	   mov [CTRL_INFO.glob_cntrl], eax
917
	   mov [CTRL_INFO.glob_cntrl], eax
918
 
918
 
Line 919... Line 919...
919
	   mov edx, CTRL_STAT
919
	   mov edx, CTRL_STAT
920
           call [ctrl.ctrl_read32]
920
	   call [ctrl.ctrl_read32]
921
	   mov [CTRL_INFO.glob_sta], eax
921
	   mov [CTRL_INFO.glob_sta], eax
Line 987... Line 987...
987
endp
987
endp
Line 988... Line 988...
988
 
988
 
989
align 4
989
align 4
Line 990... Line 990...
990
proc codec_check_ready
990
proc codec_check_ready
991
 
991
 
992
           mov edx, CTRL_ST
992
	   mov edx, CTRL_ST
993
           call [ctrl.ctrl_read32]
993
	   call [ctrl.ctrl_read32]
994
           and eax, CTRL_ST_CREADY
994
	   and eax, CTRL_ST_CREADY
995
           jz .not_ready
995
	   jz .not_ready
996
 
996
 
997
           xor eax, wax
997
	   xor eax, wax
998
           inc eax
998
	   inc eax
999
           ret
999
	   ret
1000
.not_ready:
1000
.not_ready:
1001
           xor eax, eax
1001
	   xor eax, eax
Line 1002... Line 1002...
1002
           ret
1002
	   ret
1003
endp
1003
endp
1004
 
1004
 
Line 1042... Line 1042...
1042
	   adc ecx,edx
1042
	   adc ecx,edx
1043
@@:
1043
@@:
1044
	   rdtsc
1044
	   rdtsc
1045
	   sub eax, ebx
1045
	   sub eax, ebx
1046
	   sbb edx, ecx
1046
	   sbb edx, ecx
1047
           js @B
1047
	   js @B
Line 1048... Line 1048...
1048
 
1048
 
1049
	   pop eax
1049
	   pop eax
1050
	   pop ebx
1050
	   pop ebx
1051
	   pop edx
1051
	   pop edx
Line 1057... Line 1057...
1057
;          CONTROLLER IO functions
1057
;          CONTROLLER IO functions
1058
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1058
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 1059... Line 1059...
1059
 
1059
 
1060
align 4
1060
align 4
1061
codec_io_r16:
1061
codec_io_r16:
1062
           add edx, [ctrl.codec_io_base]
1062
	   add edx, [ctrl.codec_io_base]
1063
           in  ax, dx
1063
	   in  ax, dx
Line 1064... Line 1064...
1064
           ret
1064
	   ret
1065
 
1065
 
1066
align 4
1066
align 4
1067
codec_io_w16:
1067
codec_io_w16:
1068
           add edx, [ctrl.codec_io_base]
1068
	   add edx, [ctrl.codec_io_base]
Line 1069... Line 1069...
1069
           out dx, ax
1069
	   out dx, ax
1070
           ret
1070
	   ret
1071
 
1071
 
1072
align 4
1072
align 4
1073
ctrl_io_r8:
1073
ctrl_io_r8:
Line 1074... Line 1074...
1074
           add edx, [ctrl.ctrl_io_base]
1074
	   add edx, [ctrl.ctrl_io_base]
1075
           in  al, dx
1075
	   in  al, dx
1076
           ret
1076
	   ret
1077
 
1077
 
1078
align 4
1078
align 4
Line 1079... Line 1079...
1079
ctrl_io_r16:
1079
ctrl_io_r16:
1080
          add edx, [ctrl.ctrl_io_base]
1080
	  add edx, [ctrl.ctrl_io_base]
1081
          in  ax, dx
1081
	  in  ax, dx
1082
          ret
1082
	  ret
1083
 
1083
 
Line 1084... Line 1084...
1084
align 4
1084
align 4
1085
ctrl_io_r32:
1085
ctrl_io_r32:
1086
          add edx, [ctrl.ctrl_io_base]
1086
	  add edx, [ctrl.ctrl_io_base]
1087
          in  eax, dx
1087
	  in  eax, dx
1088
          ret
1088
	  ret
Line 1089... Line 1089...
1089
 
1089
 
1090
align 4
1090
align 4
1091
ctrl_io_w8:
1091
ctrl_io_w8:
1092
          add edx, [ctrl.ctrl_io_base]
1092
	  add edx, [ctrl.ctrl_io_base]
1093
          out dx, al
1093
	  out dx, al
Line 1094... Line 1094...
1094
          ret
1094
	  ret
1095
 
1095
 
1096
align 4
1096
align 4
1097
ctrl_io_w16:
1097
ctrl_io_w16:
1098
          add edx, [ctrl.ctrl_io_base]
1098
	  add edx, [ctrl.ctrl_io_base]
Line 1099... Line 1099...
1099
          out dx, ax
1099
	  out dx, ax
1100
          ret
1100
	  ret
1101
 
1101
 
1102
align 4
1102
align 4
1103
ctrl_io_w32:
1103
ctrl_io_w32:
1104
          add edx, [ctrl.ctrl_io_base]
1104
	  add edx, [ctrl.ctrl_io_base]
1105
          out dx, eax
1105
	  out dx, eax
1106
          ret
1106
	  ret
1107
 
1107
 
1108
 
1108
 
1109
align 4
1109
align 4
1110
dword2str:
1110
dword2str:
1111
          mov  esi, hex_buff
1111
	  mov  esi, hex_buff
Line 1112... Line 1112...
1112
          mov ecx, -8
1112
	  mov ecx, -8
1113
@@:
1113
@@:
Line 1114... Line 1114...
1114
          rol eax, 4
1114
	  rol eax, 4
Line 1115... Line 1115...
1115
          mov ebx, eax
1115
	  mov ebx, eax
1116
          and ebx, 0x0F
1116
	  and ebx, 0x0F
1117
          mov bl, [ebx+hexletters]
1117
	  mov bl, [ebx+hexletters]
1118
          mov [8+esi+ecx], bl
1118
	  mov [8+esi+ecx], bl
Line 1119... Line 1119...
1119
          inc ecx
1119
	  inc ecx
Line 1120... Line 1120...
1120
          jnz @B
1120
	  jnz @B
1121
          ret
1121
	  ret
Line 1143... Line 1143...
1143
msgAttchIRQ  db 'IRQ line not supported', 13,10, 0
1143
msgAttchIRQ  db 'IRQ line not supported', 13,10, 0
1144
msgInvIRQ    db 'IRQ line not assigned or invalid', 13,10, 0
1144
msgInvIRQ    db 'IRQ line not assigned or invalid', 13,10, 0
1145
msgPlay      db 'start play', 13,10,0
1145
msgPlay      db 'start play', 13,10,0
1146
msgStop      db 'stop play',  13,10,0
1146
msgStop      db 'stop play',  13,10,0
1147
msgNotify    db 'call notify',13,10,0
1147
msgNotify    db 'call notify',13,10,0
1148
msgIRQ       db 'AC97 IRQ', 13,10,0
1148
msgIRQ	     db 'AC97 IRQ', 13,10,0
1149
msgInitCtrl  db 'init controller',13,10,0
1149
msgInitCtrl  db 'init controller',13,10,0
1150
msgInitCodec db 'init codec',13,10,0
1150
msgInitCodec db 'init codec',13,10,0
1151
msgPrimBuff  db 'create primary buffer',13,10,0
1151
msgPrimBuff  db 'create primary buffer',13,10,0
1152
msgReg       db 'set service handler',13,10,0
1152
msgReg	     db 'set service handler',13,10,0
1153
msgOk        db 'service installed',13,10,0
1153
msgOk	     db 'service installed',13,10,0
1154
msgCold      db 'cold reset',13,10,0
1154
msgCold      db 'cold reset',13,10,0
1155
msgWarm      db 'warm reset',13,10,0
1155
msgWarm      db 'warm reset',13,10,0
1156
msgWRFail    db 'warm reset failed',13,10,0
1156
msgWRFail    db 'warm reset failed',13,10,0
1157
msgCRFail    db 'cold reset failed',13,10,0
1157
msgCRFail    db 'cold reset failed',13,10,0
1158
msgCFail     db 'codec not ready',13,10,0
1158
msgCFail     db 'codec not ready',13,10,0
Line 1163... Line 1163...
1163
msgIObase    db 'IO base         ',0
1163
msgIObase    db 'IO base         ',0
1164
msgIRQline   db 'IRQ line        ',0
1164
msgIRQline   db 'IRQ line        ',0
Line 1165... Line 1165...
1165
 
1165
 
Line 1166... Line 1166...
1166
section '.data' data readable writable align 16
1166
section '.data' data readable writable align 16
1167
 
1167
 
Line 1168... Line 1168...
1168
pcmout_bdl       rq 32
1168
pcmout_bdl	 rq 32
1169
buff_list        rd 32
1169
buff_list	 rd 32
Line 1170... Line 1170...
1170
 
1170