Subversion Repositories Kolibri OS

Rev

Rev 285 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 285 Rev 378
1
format MS COFF
1
format MS COFF
2
 
2
 
3
include 'proc32.inc'
3
include 'proc32.inc'
4
include 'imports.inc'
4
include 'imports.inc'
5
 
5
 
6
DEBUG	    equ 1
6
DEBUG	    equ 1
7
 
7
 
8
CPU_FREQ    equ  2000d	 ;cpu freq in MHz
8
CPU_FREQ    equ  2000d	 ;cpu freq in MHz
9
 
9
 
10
BIT0  EQU 0x00000001
10
BIT0  EQU 0x00000001
11
BIT1  EQU 0x00000002
11
BIT1  EQU 0x00000002
12
BIT2  EQU 0x00000004
12
BIT2  EQU 0x00000004
13
BIT3  EQU 0x00000008
13
BIT3  EQU 0x00000008
14
BIT4  EQU 0x00000010
14
BIT4  EQU 0x00000010
15
BIT5  EQU 0x00000020
15
BIT5  EQU 0x00000020
16
BIT6  EQU 0x00000040
16
BIT6  EQU 0x00000040
17
BIT7  EQU 0x00000080
17
BIT7  EQU 0x00000080
18
BIT8  EQU 0x00000100
18
BIT8  EQU 0x00000100
19
BIT9  EQU 0x00000200
19
BIT9  EQU 0x00000200
20
BIT10 EQU 0x00000400
20
BIT10 EQU 0x00000400
21
BIT11 EQU 0x00000800
21
BIT11 EQU 0x00000800
22
BIT12 EQU 0x00001000
22
BIT12 EQU 0x00001000
23
BIT13 EQU 0x00002000
23
BIT13 EQU 0x00002000
24
BIT14 EQU 0x00004000
24
BIT14 EQU 0x00004000
25
BIT15 EQU 0x00008000
25
BIT15 EQU 0x00008000
26
BIT16 EQU 0x00010000
26
BIT16 EQU 0x00010000
27
BIT17 EQU 0x00020000
27
BIT17 EQU 0x00020000
28
BIT18 EQU 0x00040000
28
BIT18 EQU 0x00040000
29
BIT19 EQU 0x00080000
29
BIT19 EQU 0x00080000
30
BIT20 EQU 0x00100000
30
BIT20 EQU 0x00100000
31
BIT21 EQU 0x00200000
31
BIT21 EQU 0x00200000
32
BIT22 EQU 0x00400000
32
BIT22 EQU 0x00400000
33
BIT23 EQU 0x00800000
33
BIT23 EQU 0x00800000
34
BIT24 EQU 0x00100000
34
BIT24 EQU 0x00100000
35
BIT25 EQU 0x02000000
35
BIT25 EQU 0x02000000
36
BIT26 EQU 0x04000000
36
BIT26 EQU 0x04000000
37
BIT27 EQU 0x08000000
37
BIT27 EQU 0x08000000
38
BIT28 EQU 0x10000000
38
BIT28 EQU 0x10000000
39
BIT29 EQU 0x20000000
39
BIT29 EQU 0x20000000
40
BIT30 EQU 0x40000000
40
BIT30 EQU 0x40000000
41
BIT31 EQU 0x80000000
41
BIT31 EQU 0x80000000
42
 
42
 
43
VID_SIS           equ 0x1039
43
VID_SIS           equ 0x1039
44
CTRL_SIS          equ 0x7012
44
CTRL_SIS          equ 0x7012
45
 
45
 
46
PCM_OUT_BDL	  equ  0x10	 ; PCM out buffer descriptors list
46
PCM_OUT_BDL       equ  0x10  ; PCM out buffer descriptors list
47
PCM_OUT_CR_REG	  equ  0x1b	 ; PCM out Control Register
47
PCM_OUT_CR_REG    equ  0x1b  ; PCM out Control Register
48
PCM_OUT_LVI_REG   equ  0x15	 ; PCM last valid index
48
PCM_OUT_LVI_REG   equ  0x15	 ; PCM last valid index
49
PCM_OUT_SR_REG	  equ  0x18	 ; PCM out Status register
49
PCM_OUT_SR_REG    equ  0x18  ; PCM out Status register
50
PCM_OUT_PIV_REG   equ  0x1a	 ; PCM out prefetched index
50
PCM_OUT_PIV_REG   equ  0x1a	 ; PCM out prefetched index
51
PCM_OUT_CIV_REG   equ  0x14      ; PCM out current index
51
PCM_OUT_CIV_REG   equ  0x14      ; PCM out current index
52
 
52
 
53
PCM_IN_CR_REG     equ  0x0b      ; PCM in Control Register
53
PCM_IN_CR_REG     equ  0x0b      ; PCM in Control Register
54
MC_IN_CR_REG	  equ  0x2b	 ; MIC in Control Register
54
MC_IN_CR_REG      equ  0x2b  ; MIC in Control Register
55
RR		  equ  BIT1	 ; reset registers.  Nukes all regs
55
RR		  equ  BIT1	 ; reset registers.  Nukes all regs
56
 
56
 
57
CODEC_MASTER_VOL_REG            equ     0x02
57
CODEC_MASTER_VOL_REG            equ     0x02
58
CODEC_AUX_VOL                   equ     0x04    ;
58
CODEC_AUX_VOL                   equ     0x04    ;
59
CODEC_PCM_OUT_REG		equ	18h	; PCM output volume
59
CODEC_PCM_OUT_REG		equ	18h	; PCM output volume
60
CODEC_EXT_AUDIO_REG		equ	28h	; extended audio
60
CODEC_EXT_AUDIO_REG		equ	28h	; extended audio
61
CODEC_EXT_AUDIO_CTRL_REG	equ	2ah	; extended audio control
61
CODEC_EXT_AUDIO_CTRL_REG	equ	2ah	; extended audio control
62
CODEC_PCM_FRONT_DACRATE_REG	equ	2ch	; PCM out sample rate
62
CODEC_PCM_FRONT_DACRATE_REG	equ	2ch	; PCM out sample rate
63
CODEC_PCM_SURND_DACRATE_REG	equ	2eh	; surround sound sample rate
63
CODEC_PCM_SURND_DACRATE_REG	equ	2eh	; surround sound sample rate
64
CODEC_PCM_LFE_DACRATE_REG	equ	30h	; LFE sample rate
64
CODEC_PCM_LFE_DACRATE_REG	equ	30h	; LFE sample rate
65
 
65
 
66
 
66
 
67
GLOB_CTRL      equ  0x2C        ;   Global Control
67
GLOB_CTRL         equ  0x2C        ;   Global Control
68
CTRL_STAT       equ  0x30        ;   Global Status
68
CTRL_STAT         equ  0x30        ;   Global Status
69
CTRL_CAS	equ  0x34	 ;   Codec Access Semiphore
69
CTRL_CAS          equ  0x34        ;   Codec Access Semiphore
70
 
70
 
71
CAS_FLAG       equ  0x01	;   Codec Access Semiphore Bit
71
CAS_FLAG          equ  0x01        ;   Codec Access Semiphore Bit
72
 
72
 
73
CTRL_ST_CREADY	equ  BIT8+BIT9+BIT28 ;   Primary Codec Ready
73
CTRL_ST_CREADY    equ  BIT8+BIT9+BIT28 ;   Primary Codec Ready
74
 
74
 
75
CTRL_ST_RCS	equ  0x00008000  ;   Read Completion Status
75
CTRL_ST_RCS       equ  0x00008000  ;   Read Completion Status
76
 
76
 
77
CTRL_CNT_CRIE	equ  BIT4+BIT5+BIT6  ;   Codecs Resume Interrupt Enable
77
CTRL_CNT_CRIE     equ  BIT4+BIT5+BIT6  ;   Codecs Resume Interrupt Enable
78
CTRL_CNT_AC_OFF equ  0x00000008  ;   ACLINK Off
78
CTRL_CNT_AC_OFF   equ  0x00000008  ;   ACLINK Off
79
CTRL_CNT_WARM	equ  0x00000004  ;   AC97 Warm Reset
79
CTRL_CNT_WARM     equ  0x00000004  ;   AC97 Warm Reset
80
CTRL_CNT_COLD	equ  0x00000002  ;   AC97 Cold Reset
80
CTRL_CNT_COLD     equ  0x00000002  ;   AC97 Cold Reset
81
CTRL_CNT_GIE	equ  0x00000001  ;   GPI Interrupt Enable
81
CTRL_CNT_GIE      equ  0x00000001  ;   GPI Interrupt Enable
82
 
82
 
83
CODEC_REG_POWERDOWN   equ 0x26
83
CODEC_REG_POWERDOWN   equ 0x26
84
CODEC_REG_ST	      equ 0x26
84
CODEC_REG_ST          equ 0x26
85
 
85
 
86
 
86
 
87
DEV_PLAY              equ  1
87
DEV_PLAY              equ  1
88
DEV_STOP              equ  2
88
DEV_STOP              equ  2
89
DEV_CALLBACK          equ  3
89
DEV_CALLBACK          equ  3
90
DEV_SET_BUFF          equ  4
90
DEV_SET_BUFF          equ  4
91
DEV_NOTIFY            equ  5
91
DEV_NOTIFY            equ  5
92
DEV_SET_MASTERVOL     equ  6
92
DEV_SET_MASTERVOL     equ  6
93
DEV_GET_MASTERVOL     equ  7
93
DEV_GET_MASTERVOL     equ  7
94
DEV_GET_INFO          equ  8
94
DEV_GET_INFO          equ  8
95
 
95
 
96
struc AC_CNTRL		    ;AC controller base class
96
struc AC_CNTRL		    ;AC controller base class
97
{ .bus                dd ?
97
{ .bus                dd ?
98
  .devfn              dd ?
98
  .devfn              dd ?
99
 
99
 
100
  .vendor             dd ?
100
  .vendor             dd ?
101
  .dev_id             dd ?
101
  .dev_id             dd ?
102
  .pci_cmd            dd ?
102
  .pci_cmd            dd ?
103
  .pci_stat           dd ?
103
  .pci_stat           dd ?
104
 
104
 
105
  .codec_io_base      dd ?
105
  .codec_io_base      dd ?
106
  .codec_mem_base     dd ?
106
  .codec_mem_base     dd ?
107
 
107
 
108
  .ctrl_io_base       dd ?
108
  .ctrl_io_base       dd ?
109
  .ctrl_mem_base      dd ?
109
  .ctrl_mem_base      dd ?
110
  .cfg_reg            dd ?
110
  .cfg_reg            dd ?
111
  .int_line           dd ?
111
  .int_line           dd ?
112
 
112
 
113
  .vendor_ids         dd ?    ;vendor id string
113
  .vendor_ids         dd ?    ;vendor id string
114
  .ctrl_ids           dd ?    ;hub id string
114
  .ctrl_ids           dd ?    ;hub id string
115
 
115
 
116
  .buffer             dd ?
116
  .buffer             dd ?
117
 
117
 
118
  .notify_pos         dd ?
118
  .notify_pos         dd ?
119
  .notify_task        dd ?
119
  .notify_task        dd ?
120
 
120
 
121
  .lvi_reg            dd ?
121
  .lvi_reg            dd ?
122
  .ctrl_setup         dd ?
122
  .ctrl_setup         dd ?
123
  .user_callback      dd ?
123
  .user_callback      dd ?
124
  .codec_read16       dd ?
124
  .codec_read16       dd ?
125
  .codec_write16      dd ?
125
  .codec_write16      dd ?
126
 
126
 
127
  .ctrl_read8         dd ?
127
  .ctrl_read8         dd ?
128
  .ctrl_read16        dd ?
128
  .ctrl_read16        dd ?
129
  .ctrl_read32        dd ?
129
  .ctrl_read32        dd ?
130
 
130
 
131
  .ctrl_write8        dd ?
131
  .ctrl_write8        dd ?
132
  .ctrl_write16       dd ?
132
  .ctrl_write16       dd ?
133
  .ctrl_write32       dd ?
133
  .ctrl_write32       dd ?
134
}
134
}
135
 
135
 
136
struc CODEC		   ;Audio Chip base class
136
struc CODEC		   ;Audio Chip base class
137
{
137
{
138
  .chip_id            dd ?
138
  .chip_id            dd ?
139
  .flags              dd ?
139
  .flags              dd ?
140
  .status             dd ?
140
  .status             dd ?
141
 
141
 
142
  .ac_vendor_ids      dd ?    ;ac vendor id string
142
  .ac_vendor_ids      dd ?    ;ac vendor id string
143
  .chip_ids           dd ?    ;chip model string
143
  .chip_ids           dd ?    ;chip model string
144
 
144
 
145
  .shadow_flag        dd ?
145
  .shadow_flag        dd ?
146
                      dd ?
146
                      dd ?
147
 
147
 
148
  .regs               dw ?     ; codec registers
148
  .regs               dw ?     ; codec registers
149
  .reg_master_vol     dw ?     ;0x02
149
  .reg_master_vol     dw ?     ;0x02
150
  .reg_aux_out_vol    dw ?     ;0x04
150
  .reg_aux_out_vol    dw ?     ;0x04
151
  .reg_mone_vol       dw ?     ;0x06
151
  .reg_mone_vol       dw ?     ;0x06
152
  .reg_master_tone    dw ?     ;0x08
152
  .reg_master_tone    dw ?     ;0x08
153
  .reg_beep_vol       dw ?     ;0x0A
153
  .reg_beep_vol       dw ?     ;0x0A
154
  .reg_phone_vol      dw ?     ;0x0C
154
  .reg_phone_vol      dw ?     ;0x0C
155
  .reg_mic_vol        dw ?     ;0x0E
155
  .reg_mic_vol        dw ?     ;0x0E
156
  .reg_line_in_vol    dw ?     ;0x10
156
  .reg_line_in_vol    dw ?     ;0x10
157
  .reg_cd_vol         dw ?     ;0x12
157
  .reg_cd_vol         dw ?     ;0x12
158
  .reg_video_vol      dw ?     ;0x14
158
  .reg_video_vol      dw ?     ;0x14
159
  .reg_aux_in_vol     dw ?     ;0x16
159
  .reg_aux_in_vol     dw ?     ;0x16
160
  .reg_pcm_out_vol    dw ?     ;0x18
160
  .reg_pcm_out_vol    dw ?     ;0x18
161
  .reg_rec_select     dw ?     ;0x1A
161
  .reg_rec_select     dw ?     ;0x1A
162
  .reg_rec_gain       dw ?     ;0x1C
162
  .reg_rec_gain       dw ?     ;0x1C
163
  .reg_rec_gain_mic   dw ?     ;0x1E
163
  .reg_rec_gain_mic   dw ?     ;0x1E
164
  .reg_gen            dw ?     ;0x20
164
  .reg_gen            dw ?     ;0x20
165
  .reg_3d_ctrl        dw ?     ;0X22
165
  .reg_3d_ctrl        dw ?     ;0X22
166
  .reg_page           dw ?     ;0X24
166
  .reg_page           dw ?     ;0X24
167
  .reg_powerdown      dw ?     ;0x26
167
  .reg_powerdown      dw ?     ;0x26
168
  .reg_ext_audio      dw ?     ;0x28
168
  .reg_ext_audio      dw ?     ;0x28
169
  .reg_ext_st         dw ?     ;0x2a
169
  .reg_ext_st         dw ?     ;0x2a
170
  .reg_pcm_front_rate dw ?     ;0x2c
170
  .reg_pcm_front_rate dw ?     ;0x2c
171
  .reg_pcm_surr_rate  dw ?     ;0x2e
171
  .reg_pcm_surr_rate  dw ?     ;0x2e
172
  .reg_lfe_rate       dw ?     ;0x30
172
  .reg_lfe_rate       dw ?     ;0x30
173
  .reg_pcm_in_rate    dw ?     ;0x32
173
  .reg_pcm_in_rate    dw ?     ;0x32
174
                      dw ?     ;0x34
174
                      dw ?     ;0x34
175
  .reg_cent_lfe_vol   dw ?     ;0x36
175
  .reg_cent_lfe_vol   dw ?     ;0x36
176
  .reg_surr_vol       dw ?     ;0x38
176
  .reg_surr_vol       dw ?     ;0x38
177
  .reg_spdif_ctrl     dw ?     ;0x3A
177
  .reg_spdif_ctrl     dw ?     ;0x3A
178
                      dw ?     ;0x3C
178
                      dw ?     ;0x3C
179
                      dw ?     ;0x3E
179
                      dw ?     ;0x3E
180
                      dw ?     ;0x40
180
                      dw ?     ;0x40
181
                      dw ?     ;0x42
181
                      dw ?     ;0x42
182
                      dw ?     ;0x44
182
                      dw ?     ;0x44
183
                      dw ?     ;0x46
183
                      dw ?     ;0x46
184
                      dw ?     ;0x48
184
                      dw ?     ;0x48
185
                      dw ?     ;0x4A
185
                      dw ?     ;0x4A
186
                      dw ?     ;0x4C
186
                      dw ?     ;0x4C
187
                      dw ?     ;0x4E
187
                      dw ?     ;0x4E
188
                      dw ?     ;0x50
188
                      dw ?     ;0x50
189
                      dw ?     ;0x52
189
                      dw ?     ;0x52
190
                      dw ?     ;0x54
190
                      dw ?     ;0x54
191
                      dw ?     ;0x56
191
                      dw ?     ;0x56
192
                      dw ?     ;0x58
192
                      dw ?     ;0x58
193
                      dw ?     ;0x5A
193
                      dw ?     ;0x5A
194
                      dw ?     ;0x5C
194
                      dw ?     ;0x5C
195
                      dw ?     ;0x5E
195
                      dw ?     ;0x5E
196
  .reg_page_0         dw ?     ;0x60
196
  .reg_page_0         dw ?     ;0x60
197
  .reg_page_1         dw ?     ;0x62
197
  .reg_page_1         dw ?     ;0x62
198
  .reg_page_2         dw ?     ;0x64
198
  .reg_page_2         dw ?     ;0x64
199
  .reg_page_3         dw ?     ;0x66
199
  .reg_page_3         dw ?     ;0x66
200
  .reg_page_4         dw ?     ;0x68
200
  .reg_page_4         dw ?     ;0x68
201
  .reg_page_5         dw ?     ;0x6A
201
  .reg_page_5         dw ?     ;0x6A
202
  .reg_page_6         dw ?     ;0x6C
202
  .reg_page_6         dw ?     ;0x6C
203
  .reg_page_7         dw ?     ;0x6E
203
  .reg_page_7         dw ?     ;0x6E
204
                      dw ?     ;0x70
204
                      dw ?     ;0x70
205
                      dw ?     ;0x72
205
                      dw ?     ;0x72
206
                      dw ?     ;0x74
206
                      dw ?     ;0x74
207
                      dw ?     ;0x76
207
                      dw ?     ;0x76
208
                      dw ?     ;0x78
208
                      dw ?     ;0x78
209
                      dw ?     ;0x7A
209
                      dw ?     ;0x7A
210
  .reg_vendor_id_1    dw ?     ;0x7C
210
  .reg_vendor_id_1    dw ?     ;0x7C
211
  .reg_vendor_id_2    dw ?     ;0x7E
211
  .reg_vendor_id_2    dw ?     ;0x7E
212
 
212
 
213
 
213
 
214
  .reset              dd ?    ;virual
214
  .reset              dd ?    ;virual
215
  .set_master_vol     dd ?
215
  .set_master_vol     dd ?
216
}
216
}
217
 
217
 
218
struc CTRL_INFO
218
struc CTRL_INFO
219
{   .pci_cmd	    dd	?
219
{   .pci_cmd          dd ?
220
    .irq            dd  ?
220
    .irq              dd ?
221
    .glob_cntrl     dd  ?
221
    .glob_cntrl       dd ?
222
    .glob_sta       dd  ?
222
    .glob_sta         dd ?
223
    .codec_io_base  dd	?
223
    .codec_io_base    dd ?
224
    .ctrl_io_base   dd	?
224
    .ctrl_io_base     dd ?
225
    .codec_mem_base dd	?
225
    .codec_mem_base   dd ?
226
    .ctrl_mem_base  dd	?
226
    .ctrl_mem_base    dd ?
227
    .codec_id       dd  ?
227
    .codec_id         dd ?
228
}
228
}
229
 
229
 
230
struc IOCTL
230
struc IOCTL
231
{  .handle           dd ?
231
{  .handle            dd ?
232
   .io_code          dd ?
232
   .io_code           dd ?
233
   .input            dd ?
233
   .input             dd ?
234
   .inp_size         dd ?
234
   .inp_size          dd ?
235
   .output           dd ?
235
   .output            dd ?
236
   .out_size         dd ?
236
   .out_size          dd ?
237
}
237
}
238
 
238
 
239
virtual at 0
239
virtual at 0
240
  IOCTL IOCTL
240
  IOCTL IOCTL
241
end virtual
241
end virtual
242
 
242
 
243
EVENT_NOTIFY	      equ 0x00000200
243
EVENT_NOTIFY	      equ 0x00000200
244
 
244
 
245
OS_BASE 	      equ 0;  0x80400000
245
OS_BASE            equ 0;  0x80400000
246
new_app_base	      equ 0x60400000;   0x01000000
246
PROC_BASE          equ OS_BASE+0x0080000
247
PROC_BASE	      equ OS_BASE+0x0080000
-
 
248
 
247
new_app_base       equ 0x80000000
-
 
248
 
249
public START
249
public START
250
public service_proc
250
public service_proc
251
public version
251
public version
252
 
252
 
253
section '.flat' code readable align 16
253
section '.flat' code readable align 16
254
 
254
 
255
proc START stdcall, state:dword
255
proc START stdcall, state:dword
256
 
256
 
257
           cmp [state], 1
257
           cmp [state], 1
258
           jne .stop
258
           jne .stop
259
 
259
 
260
     if DEBUG
260
     if DEBUG
261
           mov esi, msgInit
261
           mov esi, msgInit
262
           call SysMsgBoardStr
262
           call SysMsgBoardStr
263
     end if
263
     end if
264
 
264
 
265
           call detect_controller
265
           call detect_controller
266
           test eax, eax
266
           test eax, eax
267
           jz .fail
267
           jz .fail
268
 
268
 
269
     if DEBUG
269
     if DEBUG
270
           mov esi,[ctrl.vendor_ids]
270
           mov esi,[ctrl.vendor_ids]
271
           call SysMsgBoardStr
271
           call SysMsgBoardStr
272
           mov  esi, [ctrl.ctrl_ids]
272
           mov  esi, [ctrl.ctrl_ids]
273
           call SysMsgBoardStr
273
           call SysMsgBoardStr
274
     end if
274
     end if
275
 
275
 
276
           call init_controller
276
           call init_controller
277
           test eax, eax
277
           test eax, eax
278
           jz .fail
278
           jz .fail
279
 
279
 
280
     if DEBUG
280
     if DEBUG
281
           mov esi, msgInitCodec
281
           mov esi, msgInitCodec
282
           call SysMsgBoardStr
282
           call SysMsgBoardStr
283
     end if
283
     end if
284
 
284
 
285
	   call init_codec
285
	   call init_codec
286
           test eax, eax
286
           test eax, eax
287
           jz .fail
287
           jz .fail
288
 
288
 
289
     if DEBUG
289
     if DEBUG
290
           mov esi, [codec.ac_vendor_ids]
290
           mov esi, [codec.ac_vendor_ids]
291
           call SysMsgBoardStr
291
           call SysMsgBoardStr
292
 
292
 
293
           mov esi, [codec.chip_ids]
293
           mov esi, [codec.chip_ids]
294
           call SysMsgBoardStr
294
           call SysMsgBoardStr
295
     end if
295
     end if
296
 
296
 
297
           call reset_controller
297
           call reset_controller
298
           call setup_codec
298
           call setup_codec
299
 
299
 
300
           mov esi, msgPrimBuff
300
           mov esi, msgPrimBuff
301
           call SysMsgBoardStr
301
           call SysMsgBoardStr
302
 
302
 
303
           call create_primary_buff
303
           call create_primary_buff
304
 
304
 
305
           stdcall AttachIntHandler, [ctrl.int_line], ac97_irq
305
           stdcall AttachIntHandler, [ctrl.int_line], ac97_irq
306
 
306
 
307
           stdcall RegService, sz_sound_srv, service_proc
307
           stdcall RegService, sz_sound_srv, service_proc
308
 
308
 
309
           mov esi, msgOk
309
           mov esi, msgOk
310
           call SysMsgBoardStr
310
           call SysMsgBoardStr
311
           ret
311
           ret
312
.fail:
312
.fail:
313
   if DEBUG
313
   if DEBUG
314
           mov esi, msgFail
314
           mov esi, msgFail
315
           call SysMsgBoardStr
315
           call SysMsgBoardStr
316
   end if
316
   end if
317
           xor eax, eax
317
           xor eax, eax
318
           ret
318
           ret
319
.stop:
319
.stop:
320
           call stop
320
           call stop
321
           xor eax, eax
321
           xor eax, eax
322
           ret
322
           ret
323
endp
323
endp
324
 
324
 
325
handle     equ  IOCTL.handle
325
handle     equ  IOCTL.handle
326
io_code    equ  IOCTL.io_code
326
io_code    equ  IOCTL.io_code
327
input      equ  IOCTL.input
327
input      equ  IOCTL.input
328
inp_size   equ  IOCTL.inp_size
328
inp_size   equ  IOCTL.inp_size
329
output     equ  IOCTL.output
329
output     equ  IOCTL.output
330
out_size   equ  IOCTL.out_size
330
out_size   equ  IOCTL.out_size
331
 
331
 
332
align 4
332
align 4
333
proc service_proc stdcall, ioctl:dword
333
proc service_proc stdcall, ioctl:dword
334
 
334
 
335
           mov edi, [ioctl]
335
           mov edi, [ioctl]
336
           mov eax, [edi+io_code]
336
           mov eax, [edi+io_code]
337
           cmp eax, DEV_PLAY
337
           cmp eax, DEV_PLAY
338
           jne @F
338
           jne @F
339
     if DEBUG
339
     if DEBUG
340
           mov esi, msgPlay
340
           mov esi, msgPlay
341
           call SysMsgBoardStr
341
           call SysMsgBoardStr
342
     end if
342
     end if
343
           call play
343
           call play
344
           ret
344
           ret
345
@@:
345
@@:
346
           cmp eax, DEV_STOP
346
           cmp eax, DEV_STOP
347
           jne @F
347
           jne @F
348
     if DEBUG
348
     if DEBUG
349
           mov esi, msgStop
349
           mov esi, msgStop
350
           call SysMsgBoardStr
350
           call SysMsgBoardStr
351
     end if
351
     end if
352
           call stop
352
           call stop
353
           ret
353
           ret
354
@@:
354
@@:
355
           cmp eax, DEV_CALLBACK
355
           cmp eax, DEV_CALLBACK
356
           jne @F
356
           jne @F
357
           mov ebx, [edi+input]
357
           mov ebx, [edi+input]
358
           stdcall set_callback, [ebx]
358
           stdcall set_callback, [ebx]
359
           ret
359
           ret
360
@@:
360
@@:
361
           cmp eax, DEV_SET_MASTERVOL
361
           cmp eax, DEV_SET_MASTERVOL
362
           jne @F
362
           jne @F
363
           mov ebx, [edi+input]
363
           mov eax, [edi+input]
364
           stdcall set_master_vol, [ebx]
364
           mov eax, [eax]
-
 
365
           call set_master_vol      ;eax= vol
365
           ret
366
           ret
366
@@:
367
@@:
367
           cmp eax, DEV_GET_MASTERVOL
368
           cmp eax, DEV_GET_MASTERVOL
368
           jne @F
369
           jne @F
369
           mov ebx, [edi+output]
370
           mov ebx, [edi+output]
370
           test ebx, ebx
371
           add ebx, new_app_base
371
           jz .fail
372
           stdcall get_master_vol, ebx
372
 
-
 
373
           stdcall get_master_vol, ebx
-
 
374
           ret
373
           ret
375
@@:
374
@@:
376
           cmp eax, DEV_GET_INFO
375
           cmp eax, DEV_GET_INFO
377
           jne @F
376
           jne @F
378
           mov ebx, [edi+output]
377
           mov ebx, [edi+output]
379
           stdcall get_dev_info, ebx
378
           stdcall get_dev_info, ebx
380
           ret
379
           ret
381
@@:
380
@@:
382
.fail:
381
.fail:
383
           xor eax, eax
382
           or eax, -1
384
           ret
383
           ret
385
endp
384
endp
386
 
385
 
387
restore   handle
386
restore   handle
388
restore   io_code
387
restore   io_code
389
restore   input
388
restore   input
390
restore   inp_size
389
restore   inp_size
391
restore   output
390
restore   output
392
restore   out_size
391
restore   out_size
393
 
392
 
394
align 4
393
align 4
395
proc ac97_irq
394
proc ac97_irq
396
 
395
 
397
;     if DEBUG
396
;     if DEBUG
398
;           mov esi, msgIRQ
397
;           mov esi, msgIRQ
399
;           call SysMsgBoardStr
398
;           call SysMsgBoardStr
400
;     end if
399
;     end if
401
 
400
 
402
           mov edx, PCM_OUT_CR_REG
401
           mov edx, PCM_OUT_CR_REG
403
           mov al, 0x14
402
           mov al, 0x10
404
           call [ctrl.ctrl_write8]
403
           call [ctrl.ctrl_write8]
405
 
404
 
406
           mov ax, 0x1c
405
           mov ax, 0x1c
407
           mov edx, PCM_OUT_SR_REG
406
           mov edx, PCM_OUT_SR_REG
408
           call [ctrl.ctrl_write16]
407
           call [ctrl.ctrl_write16]
409
 
408
 
410
           mov edx, PCM_OUT_CIV_REG
409
           mov edx, PCM_OUT_CIV_REG
411
           call [ctrl.ctrl_read8]
410
           call [ctrl.ctrl_read8]
412
 
411
 
413
           and eax, 0x1F
412
           and eax, 0x1F
414
           cmp eax, [civ_val]
413
           cmp eax, [civ_val]
415
           je .skip
414
           je .skip
416
 
415
 
417
           mov [civ_val], eax
416
           mov [civ_val], eax
418
           dec eax
417
           dec eax
419
           and eax, 0x1F
418
           and eax, 0x1F
420
           mov [ctrl.lvi_reg], eax
419
           mov [ctrl.lvi_reg], eax
421
 
420
 
422
           mov edx, PCM_OUT_LVI_REG
421
           mov edx, PCM_OUT_LVI_REG
423
           call [ctrl.ctrl_write8]
422
           call [ctrl.ctrl_write8]
424
 
423
 
425
           mov edx, PCM_OUT_CR_REG
424
           mov edx, PCM_OUT_CR_REG
426
           mov ax, 0x1D
425
           mov ax, 0x11
427
           call [ctrl.ctrl_write8]
426
           call [ctrl.ctrl_write8]
428
 
427
 
429
           mov eax, [civ_val]
428
           mov eax, [civ_val]
430
           add eax, 2
429
           add eax, 1
431
           and eax, 31
430
           and eax, 31
432
           mov ebx, dword [buff_list+eax*4]
431
           mov ebx, dword [buff_list+eax*4]
433
 
432
 
434
           cmp [ctrl.user_callback], 0
433
           cmp [ctrl.user_callback], 0
435
           je @f
434
           je @f
436
 
435
 
437
           stdcall [ctrl.user_callback], ebx
436
           stdcall [ctrl.user_callback], ebx
438
@@:
437
@@:
439
           ret
438
           ret
440
 
439
 
441
.skip:
440
.skip:
442
           mov edx, PCM_OUT_CR_REG
441
           mov edx, PCM_OUT_CR_REG
443
           mov ax, 0x1D
442
           mov ax, 0x11
444
           call [ctrl.ctrl_write8]
443
           call [ctrl.ctrl_write8]
445
           ret
444
           ret
446
endp
445
endp
447
 
446
 
448
align 4
447
align 4
449
proc create_primary_buff
448
proc create_primary_buff
450
 
449
 
451
           stdcall KernelAlloc, 0x10000
450
           stdcall KernelAlloc, 0x10000
452
           mov [ctrl.buffer], eax
451
           mov [ctrl.buffer], eax
453
 
452
 
454
           mov edi, eax
453
           mov edi, eax
455
           mov ecx, 0x10000/4
454
           mov ecx, 0x10000/4
456
           xor eax, eax
455
           xor eax, eax
457
           rep stosd
456
           cld
-
 
457
           rep stosd
458
 
458
 
459
           mov eax, [ctrl.buffer]
459
           mov eax, [ctrl.buffer]
460
           call GetPgAddr
460
           call GetPgAddr
461
 
461
 
462
           mov ebx, 0xC0004000
462
           mov ebx, 0xC0004000
463
           mov ecx, 4
463
           mov ecx, 4
464
           mov edi, pcmout_bdl
464
           mov edi, pcmout_bdl
465
@@:
465
@@:
466
           mov [edi], eax
466
           mov [edi], eax
467
           mov [edi+4], ebx
467
           mov [edi+4], ebx
468
           mov [edi+32], eax
468
           mov [edi+32], eax
469
           mov [edi+4+32], ebx
469
           mov [edi+4+32], ebx
470
           mov [edi+64], eax
470
           mov [edi+64], eax
471
           mov [edi+4+64], ebx
471
           mov [edi+4+64], ebx
472
           mov [edi+96], eax
472
           mov [edi+96], eax
473
           mov [edi+4+96], ebx
473
           mov [edi+4+96], ebx
474
           mov [edi+128], eax
474
           mov [edi+128], eax
475
           mov [edi+4+128], ebx
475
           mov [edi+4+128], ebx
476
           mov [edi+160], eax
476
           mov [edi+160], eax
477
           mov [edi+4+160], ebx
477
           mov [edi+4+160], ebx
478
           mov [edi+192], eax
478
           mov [edi+192], eax
479
           mov [edi+4+192], ebx
479
           mov [edi+4+192], ebx
480
           mov [edi+224], eax
480
           mov [edi+224], eax
481
           mov [edi+4+224], ebx
481
           mov [edi+4+224], ebx
482
 
482
 
483
           add eax, 0x4000
483
           add eax, 0x4000
484
           add edi, 8
484
           add edi, 8
485
           loop @B
485
           loop @B
486
 
486
 
487
           mov edi, buff_list
487
           mov edi, buff_list
488
           mov eax, [ctrl.buffer]
488
           mov eax, [ctrl.buffer]
489
           mov ecx, 4
489
           mov ecx, 4
490
@@:
490
@@:
491
           mov [edi], eax
491
           mov [edi], eax
492
           mov [edi+16], eax
492
           mov [edi+16], eax
493
           mov [edi+32], eax
493
           mov [edi+32], eax
494
           mov [edi+48], eax
494
           mov [edi+48], eax
495
           mov [edi+64], eax
495
           mov [edi+64], eax
496
           mov [edi+80], eax
496
           mov [edi+80], eax
497
           mov [edi+96], eax
497
           mov [edi+96], eax
498
           mov [edi+112], eax
498
           mov [edi+112], eax
499
 
499
 
500
           add eax, 0x4000
500
           add eax, 0x4000
501
           add edi, 4
501
           add edi, 4
502
           loop @B
502
           loop @B
503
 
503
 
504
           mov eax, pcmout_bdl
504
           mov eax, pcmout_bdl
505
           mov ebx, eax
505
           mov ebx, eax
506
           call GetPgAddr     ;eax
506
           call GetPgAddr     ;eax
507
           and ebx, 0xFFF
507
           and ebx, 0xFFF
508
           add eax, ebx
508
           add eax, ebx
509
 
509
 
510
           mov edx, PCM_OUT_BDL
510
           mov edx, PCM_OUT_BDL
511
           call [ctrl.ctrl_write32]
511
           call [ctrl.ctrl_write32]
512
 
512
 
513
           mov eax, 16
513
           mov eax, 16
514
           mov [ctrl.lvi_reg], eax
514
           mov [ctrl.lvi_reg], eax
515
           mov edx, PCM_OUT_LVI_REG
515
           mov edx, PCM_OUT_LVI_REG
516
           call [ctrl.ctrl_write8]
516
           call [ctrl.ctrl_write8]
517
 
517
 
518
           mov edx, GLOB_CTRL
518
           mov edx, GLOB_CTRL
519
           call [ctrl.ctrl_read32]
519
           call [ctrl.ctrl_read32]
520
           and eax, not 0x000000C0
520
           and eax, not 0x000000C0
521
           mov edx, GLOB_CTRL
521
           mov edx, GLOB_CTRL
522
           call [ctrl.ctrl_write32]
522
           call [ctrl.ctrl_write32]
523
 
523
 
524
 
524
 
525
	   ret
525
	   ret
526
endp
526
endp
527
 
527
 
528
align 4
528
align 4
529
proc detect_controller
529
proc detect_controller
530
           locals
530
           locals
531
             last_bus dd ?
531
             last_bus dd ?
532
             bus      dd ?
532
             bus      dd ?
533
             devfn    dd ?
533
             devfn    dd ?
534
           endl
534
           endl
535
 
535
 
536
           xor eax, eax
536
           xor eax, eax
537
           mov [bus], eax
537
           mov [bus], eax
538
           inc eax
538
           inc eax
539
           call PciApi
539
           call PciApi
540
           cmp eax, -1
540
           cmp eax, -1
541
           je .err
541
           je .err
542
 
542
 
543
           mov [last_bus], eax
543
           mov [last_bus], eax
544
 
544
 
545
.next_bus:
545
.next_bus:
546
           and [devfn], 0
546
           and [devfn], 0
547
.next_dev:
547
.next_dev:
548
           stdcall PciRead32, [bus], [devfn], dword 0
548
           stdcall PciRead32, [bus], [devfn], dword 0
549
           test eax, eax
549
           test eax, eax
550
           jz .next
550
           jz .next
551
           cmp eax, -1
551
           cmp eax, -1
552
           je .next
552
           je .next
553
           mov edi, devices
553
           mov edi, devices
554
@@:
554
@@:
555
           mov ebx, [edi]
555
           mov ebx, [edi]
556
           test ebx, ebx
556
           test ebx, ebx
557
           jz .next
557
           jz .next
558
 
558
 
559
           cmp eax, ebx
559
           cmp eax, ebx
560
           je .found
560
           je .found
561
           add edi, 12
561
           add edi, 12
562
           jmp @B
562
           jmp @B
563
 
563
 
564
.next:
564
.next:
565
           inc [devfn]
565
           inc [devfn]
566
           cmp [devfn], 256
566
           cmp [devfn], 256
567
           jb  .next_dev
567
           jb  .next_dev
568
           mov eax, [bus]
568
           mov eax, [bus]
569
           inc eax
569
           inc eax
570
           mov [bus], eax
570
           mov [bus], eax
571
           cmp eax, [last_bus]
571
           cmp eax, [last_bus]
572
           jna .next_bus
572
           jna .next_bus
573
           xor eax, eax
573
           xor eax, eax
574
           ret
574
           ret
575
.found:
575
.found:
576
           mov ebx, [bus]
576
           mov ebx, [bus]
577
           mov [ctrl.bus], ebx
577
           mov [ctrl.bus], ebx
578
 
578
 
579
           mov ecx, [devfn]
579
           mov ecx, [devfn]
580
           mov [ctrl.devfn], ecx
580
           mov [ctrl.devfn], ecx
581
 
581
 
582
           mov edx, eax
582
           mov edx, eax
583
           and edx, 0xFFFF
583
           and edx, 0xFFFF
584
           mov [ctrl.vendor], edx
584
           mov [ctrl.vendor], edx
585
           shr eax, 16
585
           shr eax, 16
586
           mov [ctrl.dev_id], eax
586
           mov [ctrl.dev_id], eax
587
 
587
 
588
           mov ebx, [edi+4]
588
           mov ebx, [edi+4]
589
           mov [ctrl.ctrl_ids], ebx
589
           mov [ctrl.ctrl_ids], ebx
590
           mov [ctrl.vendor_ids], msg_SIS
590
           mov [ctrl.vendor_ids], msg_SIS
591
 
591
 
592
           mov esi, [edi+8]
592
           mov esi, [edi+8]
593
           mov [ctrl.ctrl_setup], esi
593
           mov [ctrl.ctrl_setup], esi
594
           ret
594
           ret
595
.err:
595
.err:
596
           xor eax, eax
596
           xor eax, eax
597
           ret
597
           ret
598
endp
598
endp
599
 
599
 
600
align 4
600
align 4
601
proc init_controller
601
proc init_controller
602
 
602
 
603
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
603
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
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
608
           mov [ctrl.pci_stat], ebx
608
           mov [ctrl.pci_stat], ebx
609
 
609
 
610
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
610
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
611
           and eax,0xFFFE
611
           and eax,0xFFFE
612
           mov [ctrl.codec_io_base], eax
612
           mov [ctrl.codec_io_base], eax
613
 
613
 
614
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
614
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
615
           and eax, 0xFFC0
615
           and eax, 0xFFC0
616
           mov [ctrl.ctrl_io_base], eax
616
           mov [ctrl.ctrl_io_base], eax
617
 
617
 
618
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18
618
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18
619
           mov [ctrl.codec_mem_base], eax
619
           mov [ctrl.codec_mem_base], eax
620
 
620
 
621
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C
621
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C
622
           mov [ctrl.ctrl_mem_base], eax
622
           mov [ctrl.ctrl_mem_base], eax
623
 
623
 
624
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
624
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
625
           and eax, 0xFF
625
           and eax, 0xFF
626
           mov [ctrl.int_line], eax
626
           mov [ctrl.int_line], eax
627
 
627
 
628
           stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
628
           stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
629
           and eax, 0xFF
629
           and eax, 0xFF
630
           mov [ctrl.cfg_reg], eax
630
           mov [ctrl.cfg_reg], eax
631
 
631
 
632
           call [ctrl.ctrl_setup]
632
           call [ctrl.ctrl_setup]
633
           xor eax, eax
633
           xor eax, eax
634
           inc eax
634
           inc eax
635
           ret
635
           ret
636
endp
636
endp
637
 
637
 
638
align 4
638
align 4
639
proc set_SIS
639
proc set_SIS
640
           mov [ctrl.codec_read16],  codec_io_r16    ;virtual
640
           mov [ctrl.codec_read16],  codec_io_r16    ;virtual
641
           mov [ctrl.codec_write16], codec_io_w16    ;virtual
641
           mov [ctrl.codec_write16], codec_io_w16    ;virtual
642
 
642
 
643
           mov [ctrl.ctrl_read8 ],  ctrl_io_r8      ;virtual
643
           mov [ctrl.ctrl_read8 ],  ctrl_io_r8      ;virtual
644
           mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
644
           mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
645
           mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
645
           mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
646
 
646
 
647
           mov [ctrl.ctrl_write8 ], ctrl_io_w8      ;virtual
647
           mov [ctrl.ctrl_write8 ], ctrl_io_w8      ;virtual
648
           mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
648
           mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
649
           mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
649
           mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
650
           ret
650
           ret
651
endp
651
endp
652
 
652
 
653
align 4
653
align 4
654
proc reset_controller
654
proc reset_controller
655
 
655
 
656
           xor eax, eax
656
           xor eax, eax
657
           mov edx, PCM_IN_CR_REG
657
           mov edx, PCM_IN_CR_REG
658
           call [ctrl.ctrl_write8]
658
           call [ctrl.ctrl_write8]
659
 
659
 
660
           mov edx, PCM_OUT_CR_REG
660
           mov edx, PCM_OUT_CR_REG
661
           call [ctrl.ctrl_write8]
661
           call [ctrl.ctrl_write8]
662
 
662
 
663
           mov edx, MC_IN_CR_REG
663
           mov edx, MC_IN_CR_REG
664
           call [ctrl.ctrl_write8]
664
           call [ctrl.ctrl_write8]
665
 
665
 
666
           mov eax, RR
666
           mov eax, RR
667
           mov edx, PCM_IN_CR_REG
667
           mov edx, PCM_IN_CR_REG
668
           call [ctrl.ctrl_write8]
668
           call [ctrl.ctrl_write8]
669
 
669
 
670
           mov edx, PCM_OUT_CR_REG
670
           mov edx, PCM_OUT_CR_REG
671
           call [ctrl.ctrl_write8]
671
           call [ctrl.ctrl_write8]
672
 
672
 
673
           mov edx, MC_IN_CR_REG
673
           mov edx, MC_IN_CR_REG
674
           call [ctrl.ctrl_write8]
674
           call [ctrl.ctrl_write8]
675
           ret
675
           ret
676
endp
676
endp
677
 
677
 
678
align 4
678
align 4
679
proc init_codec
679
proc init_codec
680
           locals
680
           locals
681
             counter dd ?
681
             counter dd ?
682
           endl
682
           endl
683
 
683
 
684
           mov esi, msgControl
684
           mov esi, msgControl
685
           call SysMsgBoardStr
685
           call SysMsgBoardStr
686
 
686
 
687
           mov edx, GLOB_CTRL
687
           mov edx, GLOB_CTRL
688
           call [ctrl.ctrl_read32]
688
           call [ctrl.ctrl_read32]
689
           call dword2str
689
           call dword2str
690
           call SysMsgBoardStr
690
           call SysMsgBoardStr
691
 
691
 
692
           mov esi, msgStatus
692
           mov esi, msgStatus
693
           call SysMsgBoardStr
693
           call SysMsgBoardStr
694
 
694
 
695
           mov edx, CTRL_STAT
695
           mov edx, CTRL_STAT
696
           call [ctrl.ctrl_read32]
696
           call [ctrl.ctrl_read32]
697
 
697
 
698
           call dword2str
698
           call dword2str
699
           call SysMsgBoardStr
699
           call SysMsgBoardStr
700
 
700
 
701
           test eax, CTRL_ST_CREADY
701
           test eax, CTRL_ST_CREADY
702
           jnz .ready
702
           jnz .ready
703
 
703
 
704
           call reset_codec
704
           call reset_codec
705
           and eax, eax
705
           and eax, eax
706
           jz .err
706
           jz .err
707
 
707
 
708
           xor edx, edx     ;ac_reg_0
708
           xor edx, edx     ;ac_reg_0
709
           call [ctrl.codec_write16]
709
           call [ctrl.codec_write16]
710
 
710
 
711
           xor eax, eax
711
           xor eax, eax
712
           mov edx, CODEC_REG_POWERDOWN
712
           mov edx, CODEC_REG_POWERDOWN
713
           call [ctrl.codec_write16]
713
           call [ctrl.codec_write16]
714
 
714
 
715
           mov [counter], 200     ; total 200*5 ms = 1s
715
           mov [counter], 200     ; total 200*5 ms = 1s
716
.wait:
716
.wait:
717
           mov edx, CODEC_REG_POWERDOWN
717
           mov edx, CODEC_REG_POWERDOWN
718
           call [ctrl.codec_read16]
718
           call [ctrl.codec_read16]
719
           and eax, 0x0F
719
           and eax, 0x0F
720
           cmp eax, 0x0F
720
           cmp eax, 0x0F
721
           je .ready
721
           je .ready
722
 
722
 
723
           mov eax, 5000          ; wait 5 ms
723
           mov eax, 5000          ; wait 5 ms
724
           call StallExec
724
           call StallExec
725
           sub [counter] , 1
725
           sub [counter] , 1
726
           jnz .wait
726
           jnz .wait
727
.err:
727
.err:
728
           xor eax, eax        ; timeout error
728
           xor eax, eax        ; timeout error
729
           ret
729
           ret
730
.ready:
730
.ready:
731
           call detect_codec
731
           call detect_codec
732
 
732
 
733
           xor eax, eax
733
           xor eax, eax
734
           inc eax
734
           inc eax
735
           ret
735
           ret
736
endp
736
endp
737
 
737
 
738
align 4
738
align 4
739
proc reset_codec
739
proc reset_codec
740
           mov edx, GLOB_CTRL
740
           mov edx, GLOB_CTRL
741
           call [ctrl.ctrl_read32]
741
           call [ctrl.ctrl_read32]
742
 
742
 
743
           test eax, 0x02
743
           test eax, 0x02
744
           jz .cold
744
           jz .cold
745
 
745
 
746
           call warm_reset
746
           call warm_reset
747
           jnc .ok
747
           jnc .ok
748
.cold:
748
.cold:
749
           call cold_reset
749
           call cold_reset
750
           jnc .ok
750
           jnc .ok
751
 
751
 
752
     if DEBUG
752
     if DEBUG
753
           mov esi, msgCFail
753
           mov esi, msgCFail
754
           call SysMsgBoardStr
754
           call SysMsgBoardStr
755
     end if
755
     end if
756
           xor eax, eax     ; timeout error
756
           xor eax, eax     ; timeout error
757
           ret
757
           ret
758
.ok:
758
.ok:
759
           xor eax, eax
759
           xor eax, eax
760
           inc eax
760
           inc eax
761
           ret
761
           ret
762
endp
762
endp
763
 
763
 
764
align 4
764
align 4
765
proc warm_reset
765
proc warm_reset
766
           locals
766
           locals
767
             counter dd ?
767
             counter dd ?
768
           endl
768
           endl
769
 
769
 
770
           mov eax, 0x06
770
           mov eax, 0x06
771
           mov edx, GLOB_CTRL
771
           mov edx, GLOB_CTRL
772
           call [ctrl.ctrl_write32]
772
           call [ctrl.ctrl_write32]
773
 
773
 
774
     if DEBUG
774
     if DEBUG
775
           mov esi, msgWarm
775
           mov esi, msgWarm
776
           call SysMsgBoardStr
776
           call SysMsgBoardStr
777
     end if
777
     end if
778
 
778
 
779
           mov [counter], 10    ; total 10*100 ms = 1s
779
           mov [counter], 10    ; total 10*100 ms = 1s
780
.wait:
780
.wait:
781
           mov eax, 100000    ; wait 100 ms
781
           mov eax, 100000    ; wait 100 ms
782
           call StallExec
782
           call StallExec
783
 
783
 
784
           mov edx, GLOB_CTRL
784
           mov edx, GLOB_CTRL
785
           call [ctrl.ctrl_read32]
785
           call [ctrl.ctrl_read32]
786
           test eax, 4
786
           test eax, 4
787
           jz .ok
787
           jz .ok
788
           sub [counter], 1
788
           sub [counter], 1
789
           jnz .wait
789
           jnz .wait
790
 
790
 
791
     if DEBUG
791
     if DEBUG
792
           mov esi, msgWRFail
792
           mov esi, msgWRFail
793
           call SysMsgBoardStr
793
           call SysMsgBoardStr
794
     end if
794
     end if
795
           stc
795
           stc
796
           ret
796
           ret
797
.ok:
797
.ok:
798
           mov edx, CTRL_STAT
798
           mov edx, CTRL_STAT
799
           call [ctrl.ctrl_read32]
799
           call [ctrl.ctrl_read32]
800
           and eax, CTRL_ST_CREADY
800
           and eax, CTRL_ST_CREADY
801
           jz .fail
801
           jz .fail
802
           clc
802
           clc
803
           ret
803
           ret
804
.fail:
804
.fail:
805
           stc
805
           stc
806
           ret
806
           ret
807
endp
807
endp
808
 
808
 
809
align 4
809
align 4
810
proc cold_reset
810
proc cold_reset
811
           locals
811
           locals
812
             counter dd ?
812
             counter dd ?
813
            endl
813
            endl
814
 
814
 
815
           mov edx, GLOB_CTRL
815
           mov edx, GLOB_CTRL
816
           call [ctrl.ctrl_read32]
816
           call [ctrl.ctrl_read32]
817
           and eax, not 0x08
817
           and eax, not 0x08
818
           or eax, 0x02
818
           or eax, 0x02
819
           mov edx, GLOB_CTRL
819
           mov edx, GLOB_CTRL
820
           call [ctrl.ctrl_write32]
820
           call [ctrl.ctrl_write32]
821
 
821
 
822
     if DEBUG
822
     if DEBUG
823
           mov esi, msgCold
823
           mov esi, msgCold
824
           call SysMsgBoardStr
824
           call SysMsgBoardStr
825
     end if
825
     end if
826
 
826
 
827
           mov [counter], 10    ; total 10*100 ms = 1s
827
           mov [counter], 10    ; total 10*100 ms = 1s
828
.wait:
828
.wait:
829
           mov eax, 100000    ; wait 100 ms
829
           mov eax, 100000    ; wait 100 ms
830
           call StallExec
830
           call StallExec
831
 
831
 
832
           mov edx, GLOB_CTRL
832
           mov edx, GLOB_CTRL
833
           call [ctrl.ctrl_read32]
833
           call [ctrl.ctrl_read32]
834
           test eax, 4
834
           test eax, 4
835
           jz .ok
835
           jz .ok
836
           sub [counter], 1
836
           sub [counter], 1
837
           jnz .wait
837
           jnz .wait
838
 
838
 
839
     if DEBUG
839
     if DEBUG
840
           mov esi, msgCRFail
840
           mov esi, msgCRFail
841
           call SysMsgBoardStr
841
           call SysMsgBoardStr
842
     end if
842
     end if
843
.fail:
843
.fail:
844
           stc
844
           stc
845
           ret
845
           ret
846
.ok:
846
.ok:
847
           mov edx, CTRL_STAT
847
           mov edx, CTRL_STAT
848
           call [ctrl.ctrl_read32]
848
           call [ctrl.ctrl_read32]
849
           and eax, CTRL_ST_CREADY
849
           and eax, CTRL_ST_CREADY
850
           jz .fail
850
           jz .fail
851
           clc
851
           clc
852
           ret
852
           ret
853
endp
853
endp
854
 
854
 
855
align 4
855
align 4
856
proc play
856
proc play
857
           xor eax, eax
857
           xor eax, eax
858
           mov [civ_val], eax
858
           mov [civ_val], eax
859
           mov edx, PCM_OUT_CIV_REG
859
           mov edx, PCM_OUT_CIV_REG
860
           call [ctrl.ctrl_write8]
860
           call [ctrl.ctrl_write8]
861
 
861
 
862
           mov eax, 16
862
           mov eax, 16
863
           mov [ctrl.lvi_reg], eax
863
           mov [ctrl.lvi_reg], eax
864
           mov edx, PCM_OUT_LVI_REG
864
           mov edx, PCM_OUT_LVI_REG
865
           call [ctrl.ctrl_write8]
865
           call [ctrl.ctrl_write8]
866
 
866
 
867
           mov edx, PCM_OUT_CR_REG
867
           mov edx, PCM_OUT_CR_REG
868
           mov ax, 0x1D
868
           mov ax, 0x1D
869
           call [ctrl.ctrl_write8]
869
           call [ctrl.ctrl_write8]
870
           ret
870
           ret
871
endp
871
endp
872
 
872
 
873
align 4
873
align 4
874
proc stop
874
proc stop
875
           mov edx, PCM_OUT_CR_REG
875
           mov edx, PCM_OUT_CR_REG
876
           mov ax, 0x0
876
           mov ax, 0x0
877
           call [ctrl.ctrl_write8]
877
           call [ctrl.ctrl_write8]
878
 
878
 
879
           mov ax, 0x1c
879
           mov ax, 0x1c
880
           mov edx, PCM_OUT_SR_REG
880
           mov edx, PCM_OUT_SR_REG
881
           call [ctrl.ctrl_write16]
881
           call [ctrl.ctrl_write16]
882
           ret
882
           ret
883
endp
883
endp
884
 
884
 
885
align 4
885
align 4
886
proc get_dev_info stdcall, p_info:dword
886
proc get_dev_info stdcall, p_info:dword
887
           virtual at esi
887
           virtual at esi
888
             CTRL_INFO CTRL_INFO
888
             CTRL_INFO CTRL_INFO
889
           end virtual
889
           end virtual
890
 
890
 
891
           mov esi, [p_info]
891
           mov esi, [p_info]
892
           mov eax, [ctrl.int_line]
892
           mov eax, [ctrl.int_line]
893
           mov ebx, [ctrl.codec_io_base]
893
           mov ebx, [ctrl.codec_io_base]
894
           mov ecx, [ctrl.ctrl_io_base]
894
           mov ecx, [ctrl.ctrl_io_base]
895
           mov edx, [ctrl.codec_mem_base]
895
           mov edx, [ctrl.codec_mem_base]
896
           mov edi, [ctrl.ctrl_mem_base]
896
           mov edi, [ctrl.ctrl_mem_base]
897
 
897
 
898
           mov [CTRL_INFO.irq], eax
898
           mov [CTRL_INFO.irq], eax
899
           mov [CTRL_INFO.codec_io_base], ebx
899
           mov [CTRL_INFO.codec_io_base], ebx
900
           mov [CTRL_INFO.ctrl_io_base], ecx
900
           mov [CTRL_INFO.ctrl_io_base], ecx
901
           mov [CTRL_INFO.codec_mem_base], edx
901
           mov [CTRL_INFO.codec_mem_base], edx
902
           mov [CTRL_INFO.ctrl_mem_base], edi
902
           mov [CTRL_INFO.ctrl_mem_base], edi
903
 
903
 
904
           mov eax, [codec.chip_id]
904
           mov eax, [codec.chip_id]
905
           mov [CTRL_INFO.codec_id], eax
905
           mov [CTRL_INFO.codec_id], eax
906
 
906
 
907
           mov edx, GLOB_CTRL
907
           mov edx, GLOB_CTRL
908
           call [ctrl.ctrl_read32]
908
           call [ctrl.ctrl_read32]
909
           mov [CTRL_INFO.glob_cntrl], eax
909
           mov [CTRL_INFO.glob_cntrl], eax
910
 
910
 
911
           mov edx, CTRL_STAT
911
           mov edx, CTRL_STAT
912
           call [ctrl.ctrl_read32]
912
           call [ctrl.ctrl_read32]
913
           mov [CTRL_INFO.glob_sta], eax
913
           mov [CTRL_INFO.glob_sta], eax
914
 
914
 
915
           mov ebx, [ctrl.pci_cmd]
915
           mov ebx, [ctrl.pci_cmd]
916
           mov [CTRL_INFO.pci_cmd], ebx
916
           mov [CTRL_INFO.pci_cmd], ebx
917
 
917
 
918
           ret
918
           ret
919
endp
919
endp
920
 
920
 
921
align 4
921
align 4
922
proc set_callback stdcall, handler:dword
922
proc set_callback stdcall, handler:dword
923
           mov eax, [handler]
923
           mov eax, [handler]
924
           mov [ctrl.user_callback], eax
924
           mov [ctrl.user_callback], eax
925
           ret
925
           ret
926
endp
926
endp
927
 
927
 
928
align 4
928
align 4
929
proc codec_read stdcall, ac_reg:dword	   ; reg = edx, reval = eax
929
proc codec_read stdcall, ac_reg:dword	   ; reg = edx, reval = eax
930
 
930
 
931
           mov edx, [ac_reg]
931
           mov edx, [ac_reg]
932
 
932
 
933
           mov ebx, edx
933
           mov ebx, edx
934
           shr ebx, 1
934
           shr ebx, 1
935
           bt [codec.shadow_flag], ebx
935
           bt [codec.shadow_flag], ebx
936
           jc .use_shadow
936
           jc .use_shadow
937
 
937
 
938
           call [ctrl.codec_read16]  ;change edx !!!
938
           call [ctrl.codec_read16]  ;change edx !!!
939
           mov ecx, eax
939
           mov ecx, eax
940
 
940
 
941
           mov edx, CTRL_STAT
941
           mov edx, CTRL_STAT
942
           call [ctrl.ctrl_read32]
942
           call [ctrl.ctrl_read32]
943
           test eax, CTRL_ST_RCS
943
           test eax, CTRL_ST_RCS
944
           jz .read_ok
944
           jz .read_ok
945
 
945
 
946
           mov edx, CTRL_STAT
946
           mov edx, CTRL_STAT
947
           call [ctrl.ctrl_write32]
947
           call [ctrl.ctrl_write32]
948
           xor eax,eax
948
           xor eax,eax
949
           not eax  ;timeout
949
           not eax  ;timeout
950
           ret
950
           ret
951
.read_ok:
951
.read_ok:
952
           mov edx, [ac_reg]
952
           mov edx, [ac_reg]
953
           mov [codec.regs+edx], cx
953
           mov [codec.regs+edx], cx
954
           bts [codec.shadow_flag], ebx
954
           bts [codec.shadow_flag], ebx
955
           mov eax, ecx
955
           mov eax, ecx
956
           ret
956
           ret
957
.use_shadow:
957
.use_shadow:
958
           movzx eax, word [codec.regs+edx]
958
           movzx eax, word [codec.regs+edx]
959
           ret
959
           ret
960
endp
960
endp
961
 
961
 
962
align 4
962
align 4
963
proc codec_write stdcall, ac_reg:dword
963
proc codec_write stdcall, ac_reg:dword
964
           push eax
964
           push eax
965
           call check_semafore
965
           call check_semafore
966
           and eax, eax
966
           and eax, eax
967
           jz .err
967
           jz .err
968
           pop eax
968
           pop eax
969
 
969
 
970
           mov esi, [ac_reg]
970
           mov esi, [ac_reg]
971
           mov edx, esi
971
           mov edx, esi
972
           call [ctrl.codec_write16]
972
           call [ctrl.codec_write16]
973
           mov [codec.regs+esi], ax
973
           mov [codec.regs+esi], ax
974
           shr esi, 1
974
           shr esi, 1
975
           bts [codec.shadow_flag], esi
975
           bts [codec.shadow_flag], esi
976
           ret
976
           ret
977
.err:
977
.err:
978
           pop eax
978
           pop eax
979
           ret
979
           ret
980
endp
980
endp
981
 
981
 
982
 
982
 
983
align 4
983
align 4
984
proc codec_check_ready
984
proc codec_check_ready
985
 
985
 
986
           mov edx, CTRL_ST
986
           mov edx, CTRL_ST
987
           call [ctrl.ctrl_read32]
987
           call [ctrl.ctrl_read32]
988
           and eax, CTRL_ST_CREADY
988
           and eax, CTRL_ST_CREADY
989
           jz .not_ready
989
           jz .not_ready
990
 
990
 
991
           xor eax, wax
991
           xor eax, wax
992
           inc eax
992
           inc eax
993
           ret
993
           ret
994
 
994
 
995
align 4
995
align 4
996
.not_ready:
996
.not_ready:
997
           xor eax, eax
997
           xor eax, eax
998
           ret
998
           ret
999
endp
999
endp
1000
 
1000
 
1001
 
1001
 
1002
align 4
1002
align 4
1003
proc check_semafore
1003
proc check_semafore
1004
           local counter:DWORD
1004
           local counter:DWORD
1005
 
1005
 
1006
           mov [counter], 100
1006
           mov [counter], 100
1007
.l1:
1007
.l1:
1008
           mov edx, CTRL_CAS
1008
           mov edx, CTRL_CAS
1009
           call [ctrl.ctrl_read8]
1009
           call [ctrl.ctrl_read8]
1010
           and eax, CAS_FLAG
1010
           and eax, CAS_FLAG
1011
           jz .ok
1011
           jz .ok
1012
 
1012
 
1013
           mov eax, 1
1013
           mov eax, 1
1014
           call StallExec
1014
           call StallExec
1015
           sub [counter], 1
1015
           sub [counter], 1
1016
           jnz .l1
1016
           jnz .l1
1017
           xor eax, eax
1017
           xor eax, eax
1018
           ret
1018
           ret
1019
align 4
1019
align 4
1020
.ok:
1020
.ok:
1021
           xor eax,eax
1021
           xor eax,eax
1022
           inc eax
1022
           inc eax
1023
           ret
1023
           ret
1024
endp
1024
endp
1025
 
1025
 
1026
align 4
1026
align 4
1027
proc StallExec
1027
proc StallExec
1028
           push ecx
1028
           push ecx
1029
           push edx
1029
           push edx
1030
           push ebx
1030
           push ebx
1031
           push eax
1031
           push eax
1032
 
1032
 
1033
           mov ecx, CPU_FREQ
1033
           mov ecx, CPU_FREQ
1034
           mul ecx
1034
           mul ecx
1035
           mov ebx, eax       ;low
1035
           mov ebx, eax       ;low
1036
           mov ecx, edx       ;high
1036
           mov ecx, edx       ;high
1037
           rdtsc
1037
           rdtsc
1038
           add ebx, eax
1038
           add ebx, eax
1039
           adc ecx, edx
1039
           adc ecx, edx
1040
@@:
1040
@@:
1041
           rdtsc
1041
           rdtsc
1042
           sub eax, ebx
1042
           sub eax, ebx
1043
           sbb edx, ecx
1043
           sbb edx, ecx
1044
           js @B
1044
           js @B
1045
 
1045
 
1046
           pop eax
1046
           pop eax
1047
           pop ebx
1047
           pop ebx
1048
           pop edx
1048
           pop edx
1049
           pop ecx
1049
           pop ecx
1050
           ret
1050
           ret
1051
endp
1051
endp
1052
 
1052
 
1053
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1053
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1054
;          CONTROLLER IO functions
1054
;          CONTROLLER IO functions
1055
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1055
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1056
 
1056
 
1057
align 4
1057
align 4
1058
proc codec_io_r16
1058
proc codec_io_r16
1059
           add edx, [ctrl.codec_io_base]
1059
           add edx, [ctrl.codec_io_base]
1060
           in  ax, dx
1060
           in  ax, dx
1061
           ret
1061
           ret
1062
endp
1062
endp
1063
 
1063
 
1064
align 4
1064
align 4
1065
proc codec_io_w16
1065
proc codec_io_w16
1066
           add edx, [ctrl.codec_io_base]
1066
           add edx, [ctrl.codec_io_base]
1067
           out dx, ax
1067
           out dx, ax
1068
           ret
1068
           ret
1069
endp
1069
endp
1070
 
1070
 
1071
align 4
1071
align 4
1072
proc ctrl_io_r8
1072
proc ctrl_io_r8
1073
           add edx, [ctrl.ctrl_io_base]
1073
           add edx, [ctrl.ctrl_io_base]
1074
           in  al, dx
1074
           in  al, dx
1075
           ret
1075
           ret
1076
endp
1076
endp
1077
 
1077
 
1078
align 4
1078
align 4
1079
proc ctrl_io_r16
1079
proc 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
endp
1083
endp
1084
 
1084
 
1085
align 4
1085
align 4
1086
proc ctrl_io_r32
1086
proc ctrl_io_r32
1087
           add edx, [ctrl.ctrl_io_base]
1087
           add edx, [ctrl.ctrl_io_base]
1088
           in  eax, dx
1088
           in  eax, dx
1089
           ret
1089
           ret
1090
endp
1090
endp
1091
 
1091
 
1092
align 4
1092
align 4
1093
proc ctrl_io_w8
1093
proc ctrl_io_w8
1094
           add edx, [ctrl.ctrl_io_base]
1094
           add edx, [ctrl.ctrl_io_base]
1095
           out dx, al
1095
           out dx, al
1096
           ret
1096
           ret
1097
endp
1097
endp
1098
 
1098
 
1099
align 4
1099
align 4
1100
proc ctrl_io_w16
1100
proc ctrl_io_w16
1101
           add edx, [ctrl.ctrl_io_base]
1101
           add edx, [ctrl.ctrl_io_base]
1102
           out dx, ax
1102
           out dx, ax
1103
           ret
1103
           ret
1104
endp
1104
endp
1105
 
1105
 
1106
align 4
1106
align 4
1107
proc ctrl_io_w32
1107
proc ctrl_io_w32
1108
           add edx, [ctrl.ctrl_io_base]
1108
           add edx, [ctrl.ctrl_io_base]
1109
           out dx, eax
1109
           out dx, eax
1110
           ret
1110
           ret
1111
endp
1111
endp
1112
 
1112
 
1113
align 4
1113
align 4
1114
dword2str:
1114
dword2str:
1115
      mov  esi, hex_buff
1115
      mov  esi, hex_buff
1116
      mov ecx, -8
1116
      mov ecx, -8
1117
@@:
1117
@@:
1118
      rol eax, 4
1118
      rol eax, 4
1119
      mov ebx, eax
1119
      mov ebx, eax
1120
      and ebx, 0x0F
1120
      and ebx, 0x0F
1121
      mov bl, [ebx+hexletters]
1121
      mov bl, [ebx+hexletters]
1122
      mov [8+esi+ecx], bl
1122
      mov [8+esi+ecx], bl
1123
      inc ecx
1123
      inc ecx
1124
      jnz @B
1124
      jnz @B
1125
      ret
1125
      ret
1126
 
1126
 
1127
 
1127
 
1128
include "codec.inc"
1128
include "codec.inc"
1129
 
1129
 
1130
align 4
1130
align 4
1131
devices dd (CTRL_SIS  shl 16)+VID_SIS,msg_AC, set_SIS
1131
devices dd (CTRL_SIS  shl 16)+VID_SIS,msg_AC, set_SIS
1132
        dd 0
1132
        dd 0
1133
 
1133
 
1134
version      dd 0x00030003
1134
version      dd 0x00040004
1135
 
1135
 
1136
msg_AC       db '7012 AC97 controller',13,10, 0
1136
msg_AC       db '7012 AC97 controller',13,10, 0
1137
msg_SIS      db 'Silicon Integrated Systems',13,10, 0
1137
msg_SIS      db 'Silicon Integrated Systems',13,10, 0
1138
 
1138
 
1139
sz_sound_srv	    db 'SOUND',0
1139
sz_sound_srv	    db 'SOUND',0
1140
 
1140
 
1141
msgInit      db 'detect hardware...',13,10,0
1141
msgInit      db 'detect hardware...',13,10,0
1142
msgFail      db 'device not found',13,10,0
1142
msgFail      db 'device not found',13,10,0
1143
msgPlay      db 'start play', 13,10,0
1143
msgPlay      db 'start play', 13,10,0
1144
msgStop      db 'stop play',  13,10,0
1144
msgStop      db 'stop play',  13,10,0
1145
msgNotify    db 'call notify',13,10,0
1145
msgNotify    db 'call notify',13,10,0
1146
msgIRQ       db 'AC97 IRQ', 13,10,0
1146
msgIRQ       db 'AC97 IRQ', 13,10,0
1147
msgInitCtrl  db 'init controller',13,10,0
1147
msgInitCtrl  db 'init controller',13,10,0
1148
msgInitCodec db 'init codec',13,10,0
1148
msgInitCodec db 'init codec',13,10,0
1149
msgPrimBuff  db 'create primary buffer',13,10,0
1149
msgPrimBuff  db 'create primary buffer',13,10,0
1150
msgReg       db 'set service handler',13,10,0
1150
msgReg       db 'set service handler',13,10,0
1151
msgOk        db 'service installed',13,10,0
1151
msgOk        db 'service installed',13,10,0
1152
msgCold      db 'cold resret',13,10,0
1152
msgCold      db 'cold resret',13,10,0
1153
msgWarm      db 'warm reset',13,10,0
1153
msgWarm      db 'warm reset',13,10,0
1154
msgWRFail    db 'warm reset failed',13,10,0
1154
msgWRFail    db 'warm reset failed',13,10,0
1155
msgCRFail    db 'cold reset failed',13,10,0
1155
msgCRFail    db 'cold reset failed',13,10,0
1156
msgCFail     db 'codec not ready',13,10,0
1156
msgCFail     db 'codec not ready',13,10,0
1157
msgStatus    db 'global status   ',0
1157
msgStatus    db 'global status   ',0
1158
msgControl   db 'global control  ',0
1158
msgControl   db 'global control  ',0
1159
 
1159
 
1160
hexletters   db '0123456789ABCDEF'
1160
hexletters   db '0123456789ABCDEF'
1161
hex_buff     db 8 dup(0),13,10,0
1161
hex_buff     db 8 dup(0),13,10,0
1162
 
1162
 
1163
 
1163
 
1164
section '.data' data readable writable align 16
1164
section '.data' data readable writable align 16
1165
 
1165
 
1166
pcmout_bdl       rq 32
1166
pcmout_bdl       rq 32
1167
buff_list        rd 32
1167
buff_list        rd 32
1168
 
1168
 
1169
codec CODEC
1169
codec CODEC
1170
ctrl AC_CNTRL
1170
ctrl AC_CNTRL
1171
 
1171
 
1172
lpc_bus  rd 1
1172
lpc_bus  rd 1
1173
civ_val  rd 1
1173
civ_val  rd 1