This source file includes following definitions.
- attach_gus_card
- probe_gus
- unload_gus
- gusintr
- probe_gus_db16
- attach_gus_db16
- unload_gus_db16
1
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 #include "sound_config.h"
31
32 #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_GUS)
33
34 #include "gus_hw.h"
35
36 void gusintr (int irq, struct pt_regs *dummy);
37
38 int gus_base, gus_irq, gus_dma;
39 extern int gus_wave_volume;
40 extern int gus_pcm_volume;
41 extern int have_gus_max;
42
43 sound_os_info *gus_osp;
44
45 long
46 attach_gus_card (long mem_start, struct address_info *hw_config)
47 {
48 int io_addr;
49
50 gus_osp = hw_config->osp;
51 snd_set_irq_handler (hw_config->irq, gusintr, "Gravis Ultrasound", hw_config->osp);
52
53 if (gus_wave_detect (hw_config->io_base))
54
55
56 {
57 mem_start = gus_wave_init (mem_start, hw_config);
58
59 request_region (hw_config->io_base, 16, "GUS");
60 request_region (hw_config->io_base + 0x100, 12, "GUS");
61
62 if (sound_alloc_dma (hw_config->dma, "GUS"))
63 printk ("gus_card.c: Can't allocate DMA channel\n");
64 if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
65 if (sound_alloc_dma (hw_config->dma2, "GUS(2)"))
66 printk ("gus_card.c: Can't allocate DMA channel2\n");
67 #ifndef EXCLUDE_MIDI
68 mem_start = gus_midi_init (mem_start);
69 #endif
70 return mem_start;
71 }
72
73 #ifndef EXCLUDE_GUS_IODETECT
74
75
76
77
78
79 for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10)
80 if (io_addr != hw_config->io_base)
81
82
83 if (gus_wave_detect (io_addr))
84 {
85 hw_config->io_base = io_addr;
86
87 printk (" WARNING! GUS found at %x, config was %x ", io_addr, hw_config->io_base);
88 mem_start = gus_wave_init (mem_start, hw_config);
89 request_region (io_addr, 16, "GUS");
90 request_region (io_addr + 0x100, 12, "GUS");
91 if (sound_alloc_dma (hw_config->dma, "GUS"))
92 printk ("gus_card.c: Can't allocate DMA channel\n");
93 if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
94 if (sound_alloc_dma (hw_config->dma2, "GUS"))
95 printk ("gus_card.c: Can't allocate DMA channel2\n");
96 #ifndef EXCLUDE_MIDI
97 mem_start = gus_midi_init (mem_start);
98 #endif
99 return mem_start;
100 }
101
102 #endif
103
104 return mem_start;
105
106
107 }
108
109 int
110 probe_gus (struct address_info *hw_config)
111 {
112 int io_addr;
113
114 gus_osp = hw_config->osp;
115
116 if (!check_region (hw_config->io_base, 16))
117 if (!check_region (hw_config->io_base + 0x100, 16))
118 if (gus_wave_detect (hw_config->io_base))
119 return 1;
120
121 #ifndef EXCLUDE_GUS_IODETECT
122
123
124
125
126
127 for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10)
128 if (io_addr != hw_config->io_base)
129
130
131 if (!check_region (io_addr, 16))
132 if (!check_region (io_addr + 0x100, 16))
133 if (gus_wave_detect (io_addr))
134 {
135 hw_config->io_base = io_addr;
136 return 1;
137 }
138
139 #endif
140
141 return 0;
142 }
143
144 void
145 unload_gus (struct address_info *hw_config)
146 {
147 DDB (printk ("unload_gus(%x)\n", hw_config->io_base));
148
149 gus_wave_unload ();
150
151 release_region (hw_config->io_base, 16);
152 release_region (hw_config->io_base + 0x100, 12);
153 snd_release_irq (hw_config->irq);
154
155 sound_free_dma (hw_config->dma);
156
157 if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
158 sound_free_dma (hw_config->dma2);
159 }
160
161 void
162 gusintr (int irq, struct pt_regs *dummy)
163 {
164 unsigned char src;
165 extern int gus_timer_enabled;
166
167 sti ();
168
169 #ifndef EXCLUDE_GUSMAX
170 if (have_gus_max)
171 ad1848_interrupt (irq, NULL);
172 #endif
173
174 while (1)
175 {
176 if (!(src = inb (u_IrqStatus)))
177 return;
178
179 if (src & DMA_TC_IRQ)
180 {
181 guswave_dma_irq ();
182 }
183
184 if (src & (MIDI_TX_IRQ | MIDI_RX_IRQ))
185 {
186 #ifndef EXCLUDE_MIDI
187 gus_midi_interrupt (0);
188 #endif
189 }
190
191 if (src & (GF1_TIMER1_IRQ | GF1_TIMER2_IRQ))
192 {
193 #ifndef EXCLUDE_SEQUENCER
194 if (gus_timer_enabled)
195 sound_timer_interrupt ();
196 gus_write8 (0x45, 0);
197 gus_timer_command (4, 0x80);
198
199 #else
200 gus_write8 (0x45, 0);
201 #endif
202 }
203
204 if (src & (WAVETABLE_IRQ | ENVELOPE_IRQ))
205 {
206 gus_voice_irq ();
207 }
208 }
209 }
210
211 #endif
212
213
214
215
216 #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_GUS16)
217
218 int
219 probe_gus_db16 (struct address_info *hw_config)
220 {
221 return ad1848_detect (hw_config->io_base, NULL, hw_config->osp);
222 }
223
224 long
225 attach_gus_db16 (long mem_start, struct address_info *hw_config)
226 {
227 gus_pcm_volume = 100;
228 gus_wave_volume = 90;
229
230 ad1848_init ("GUS 16 bit sampling", hw_config->io_base,
231 hw_config->irq,
232 hw_config->dma,
233 hw_config->dma, 0,
234 hw_config->osp);
235 return mem_start;
236 }
237
238 void
239 unload_gus_db16 (struct address_info *hw_config)
240 {
241
242 ad1848_unload (hw_config->io_base,
243 hw_config->irq,
244 hw_config->dma,
245 hw_config->dma, 0);
246 }
247 #endif