This source file includes following definitions.
- pas_read
- pas_write
- pas2_msg
- pasintr
- pas_set_intr
- pas_remove_intr
- config_pas_hw
- detect_pas_hw
- attach_pas_card
- probe_pas
1 #define _PAS2_CARD_C_
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #include "sound_config.h"
32
33 #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_PAS)
34
35 #define DEFINE_TRANSLATIONS
36 #include "pas.h"
37
38
39
40
41
42
43 int translat_code;
44 static int pas_intr_mask = 0;
45 static int pas_irq = 0;
46
47 char pas_model;
48 static char *pas_model_names[] =
49 {"", "Pro AudioSpectrum+", "CDPC", "Pro AudioSpectrum 16", "Pro AudioSpectrum 16D"};
50
51
52
53
54
55
56
57
58
59
60
61 unsigned char
62 pas_read (int ioaddr)
63 {
64 return INB (ioaddr ^ translat_code);
65 }
66
67 void
68 pas_write (unsigned char data, int ioaddr)
69 {
70 OUTB (data, ioaddr ^ translat_code);
71 }
72
73 void
74 pas2_msg (char *foo)
75 {
76 printk (" PAS2: %s.\n", foo);
77 }
78
79
80
81 void
82 pasintr (INT_HANDLER_PARMS (irq, dummy))
83 {
84 int status;
85
86 status = pas_read (INTERRUPT_STATUS);
87 pas_write (status, INTERRUPT_STATUS);
88
89
90
91 if (status & I_S_PCM_SAMPLE_BUFFER_IRQ)
92 {
93 #ifndef EXCLUDE_AUDIO
94 pas_pcm_interrupt (status, 1);
95 #endif
96 status &= ~I_S_PCM_SAMPLE_BUFFER_IRQ;
97 }
98 if (status & I_S_MIDI_IRQ)
99 {
100 #ifndef EXCLUDE_MIDI
101 #ifdef EXCLUDE_PRO_MIDI
102 pas_midi_interrupt ();
103 #endif
104 #endif
105 status &= ~I_S_MIDI_IRQ;
106 }
107
108 }
109
110 int
111 pas_set_intr (int mask)
112 {
113 int err;
114
115 if (!mask)
116 return 0;
117
118 if (!pas_intr_mask)
119 {
120 if ((err = snd_set_irq_handler (pas_irq, pasintr, "PAS16")) < 0)
121 return err;
122 }
123 pas_intr_mask |= mask;
124
125 pas_write (pas_intr_mask, INTERRUPT_MASK);
126 return 0;
127 }
128
129 int
130 pas_remove_intr (int mask)
131 {
132 if (!mask)
133 return 0;
134
135 pas_intr_mask &= ~mask;
136 pas_write (pas_intr_mask, INTERRUPT_MASK);
137
138 if (!pas_intr_mask)
139 {
140 snd_release_irq (pas_irq);
141 }
142 return 0;
143 }
144
145
146
147
148
149 int
150 config_pas_hw (struct address_info *hw_config)
151 {
152 char ok = 1;
153 unsigned int_ptrs;
154
155 pas_irq = hw_config->irq;
156
157 pas_write (0x00, INTERRUPT_MASK);
158
159 pas_write (0x36, SAMPLE_COUNTER_CONTROL);
160
161
162
163
164 pas_write (0x36, SAMPLE_RATE_TIMER);
165
166
167 pas_write (0, SAMPLE_RATE_TIMER);
168
169 pas_write (0x74, SAMPLE_COUNTER_CONTROL);
170
171
172
173
174 pas_write (0x74, SAMPLE_BUFFER_COUNTER);
175
176
177
178 pas_write (0, SAMPLE_BUFFER_COUNTER);
179
180 pas_write (F_F_PCM_BUFFER_COUNTER | F_F_PCM_RATE_COUNTER | F_F_MIXER_UNMUTE | 1, FILTER_FREQUENCY);
181 pas_write (P_C_PCM_DMA_ENABLE | P_C_PCM_MONO | P_C_PCM_DAC_MODE | P_C_MIXER_CROSS_L_TO_L | P_C_MIXER_CROSS_R_TO_R, PCM_CONTROL);
182 pas_write (S_M_PCM_RESET | S_M_FM_RESET | S_M_SB_RESET | S_M_MIXER_RESET
183
184
185 , SERIAL_MIXER);
186
187 pas_write (I_C_1_BOOT_RESET_ENABLE
188 #ifdef PAS_JOYSTICK_ENABLE
189 | I_C_1_JOYSTICK_ENABLE
190 #endif
191 ,IO_CONFIGURATION_1);
192
193 if (pas_irq < 0 || pas_irq > 15)
194 {
195 printk ("PAS2: Invalid IRQ %d", pas_irq);
196 ok = 0;
197 }
198 else
199 {
200 int_ptrs = pas_read (IO_CONFIGURATION_3);
201 int_ptrs |= I_C_3_PCM_IRQ_translate[pas_irq] & 0xf;
202 pas_write (int_ptrs, IO_CONFIGURATION_3);
203 if (!I_C_3_PCM_IRQ_translate[pas_irq])
204 {
205 printk ("PAS2: Invalid IRQ %d", pas_irq);
206 ok = 0;
207 }
208 }
209
210 if (hw_config->dma < 0 || hw_config->dma > 7)
211 {
212 printk ("PAS2: Invalid DMA selection %d", hw_config->dma);
213 ok = 0;
214 }
215 else
216 {
217 pas_write (I_C_2_PCM_DMA_translate[hw_config->dma], IO_CONFIGURATION_2);
218 if (!I_C_2_PCM_DMA_translate[hw_config->dma])
219 {
220 printk ("PAS2: Invalid DMA selection %d", hw_config->dma);
221 ok = 0;
222 }
223 }
224
225
226
227
228
229 #ifdef SYMPHONY_PAS
230 OUTB (0x05, 0xa8);
231 OUTB (0x60, 0xa9);
232 #endif
233
234 #ifdef BROKEN_BUS_CLOCK
235 pas_write (S_C_1_PCS_ENABLE | S_C_1_PCS_STEREO | S_C_1_PCS_REALSOUND | S_C_1_FM_EMULATE_CLOCK, SYSTEM_CONFIGURATION_1);
236 #else
237
238
239
240 pas_write (S_C_1_PCS_ENABLE | S_C_1_PCS_STEREO | S_C_1_PCS_REALSOUND, SYSTEM_CONFIGURATION_1);
241 #endif
242 pas_write (0x18, SYSTEM_CONFIGURATION_3);
243
244
245
246 pas_write (F_F_MIXER_UNMUTE | 0x01, FILTER_FREQUENCY);
247
248
249
250
251
252
253
254
255 if (pas_model == PAS_16 || pas_model == PAS_16D)
256 pas_write (8, PRESCALE_DIVIDER);
257 else
258 pas_write (0, PRESCALE_DIVIDER);
259
260 mix_write (P_M_MV508_ADDRESS | 5, PARALLEL_MIXER);
261 mix_write (5, PARALLEL_MIXER);
262
263 #if !defined(EXCLUDE_SB_EMULATION) || !defined(EXCLUDE_SB)
264
265 {
266 struct address_info *sb_config;
267
268 if ((sb_config = sound_getconf (SNDCARD_SB)))
269 {
270 unsigned char irq_dma;
271
272
273
274
275
276
277
278
279
280
281 pas_write (0x02, COMPATIBILITY_ENABLE);
282
283
284
285
286 pas_write ((sb_config->io_base >> 4) & 0x0f, EMULATION_ADDRESS);
287
288 if (!E_C_SB_DMA_translate[sb_config->dma])
289 printk ("\n\nPAS16 Warning: Invalid SB DMA %d\n\n",
290 sb_config->dma);
291
292 if (!E_C_SB_IRQ_translate[sb_config->irq])
293 printk ("\n\nPAS16 Warning: Invalid SB IRQ %d\n\n",
294 sb_config->irq);
295
296 irq_dma = E_C_SB_DMA_translate[sb_config->dma] |
297 E_C_SB_IRQ_translate[sb_config->irq];
298
299 pas_write (irq_dma, EMULATION_CONFIGURATION);
300 }
301 }
302 #else
303 pas_write (0x00, COMPATIBILITY_ENABLE);
304 #endif
305
306 if (!ok)
307 pas2_msg ("Driver not enabled");
308
309 return ok;
310 }
311
312 int
313 detect_pas_hw (struct address_info *hw_config)
314 {
315 unsigned char board_id, foo;
316
317
318
319
320
321
322
323
324 OUTB (0xBC, MASTER_DECODE);
325
326
327 OUTB (hw_config->io_base >> 2, MASTER_DECODE);
328
329
330 translat_code = PAS_DEFAULT_BASE ^ hw_config->io_base;
331 pas_write (1, WAIT_STATE);
332
333
334
335 board_id = pas_read (INTERRUPT_MASK);
336
337 if (board_id == 0xff)
338 return 0;
339
340
341
342
343
344
345
346 foo = board_id ^ 0xe0;
347
348 pas_write (foo, INTERRUPT_MASK);
349 foo = INB (INTERRUPT_MASK);
350 pas_write (board_id, INTERRUPT_MASK);
351
352 if (board_id != foo)
353
354
355 return 0;
356
357 pas_model = pas_read (CHIP_REV);
358
359 return pas_model;
360 }
361
362 long
363 attach_pas_card (long mem_start, struct address_info *hw_config)
364 {
365 pas_irq = hw_config->irq;
366
367 if (detect_pas_hw (hw_config))
368 {
369
370 if (pas_model = pas_read (CHIP_REV))
371 {
372 printk (" <%s rev %d>", pas_model_names[(int) pas_model], pas_read (BOARD_REV_ID));
373 }
374
375 if (config_pas_hw (hw_config))
376 {
377
378 #ifndef EXCLUDE_AUDIO
379 mem_start = pas_pcm_init (mem_start, hw_config);
380 #endif
381
382 #if !defined(EXCLUDE_SB_EMULATION) && !defined(EXCLUDE_SB)
383
384 sb_dsp_disable_midi ();
385
386
387
388 #endif
389
390 #ifndef EXCLUDE_YM3812
391 enable_opl3_mode (0x388, 0x38a, 0);
392 #endif
393
394 #ifndef EXCLUDE_MIDI
395 #ifdef EXCLUDE_PRO_MIDI
396 mem_start = pas_midi_init (mem_start);
397 #endif
398 #endif
399
400 pas_init_mixer ();
401 }
402 }
403
404 return mem_start;
405 }
406
407 int
408 probe_pas (struct address_info *hw_config)
409 {
410 return detect_pas_hw (hw_config);
411 }
412
413 #endif