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 gus_wave_unload ();
148
149 release_region (hw_config->io_base, 16);
150 release_region (hw_config->io_base + 0x100, 12);
151 snd_release_irq (hw_config->irq);
152
153 sound_free_dma (hw_config->dma);
154
155 if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
156 sound_free_dma (hw_config->dma2);
157 }
158
159 void
160 gusintr (int irq, struct pt_regs *dummy)
161 {
162 unsigned char src;
163 extern int gus_timer_enabled;
164
165 sti ();
166
167 #ifndef EXCLUDE_GUSMAX
168 if (have_gus_max)
169 ad1848_interrupt (irq, NULL);
170 #endif
171
172 while (1)
173 {
174 if (!(src = inb (u_IrqStatus)))
175 return;
176
177 if (src & DMA_TC_IRQ)
178 {
179 guswave_dma_irq ();
180 }
181
182 if (src & (MIDI_TX_IRQ | MIDI_RX_IRQ))
183 {
184 #ifndef EXCLUDE_MIDI
185 gus_midi_interrupt (0);
186 #endif
187 }
188
189 if (src & (GF1_TIMER1_IRQ | GF1_TIMER2_IRQ))
190 {
191 #ifndef EXCLUDE_SEQUENCER
192 if (gus_timer_enabled)
193 sound_timer_interrupt ();
194 gus_write8 (0x45, 0);
195 gus_timer_command (4, 0x80);
196
197 #else
198 gus_write8 (0x45, 0);
199 #endif
200 }
201
202 if (src & (WAVETABLE_IRQ | ENVELOPE_IRQ))
203 {
204 gus_voice_irq ();
205 }
206 }
207 }
208
209 #endif
210
211
212
213
214 #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_GUS16)
215
216 int
217 probe_gus_db16 (struct address_info *hw_config)
218 {
219 return ad1848_detect (hw_config->io_base, NULL, hw_config->osp);
220 }
221
222 long
223 attach_gus_db16 (long mem_start, struct address_info *hw_config)
224 {
225 gus_pcm_volume = 100;
226 gus_wave_volume = 90;
227
228 ad1848_init ("GUS 16 bit sampling", hw_config->io_base,
229 hw_config->irq,
230 hw_config->dma,
231 hw_config->dma, 0,
232 hw_config->osp);
233 return mem_start;
234 }
235
236 void
237 unload_gus_db16 (struct address_info *hw_config)
238 {
239
240 ad1848_unload (hw_config->io_base,
241 hw_config->irq,
242 hw_config->dma,
243 hw_config->dma, 0);
244 }
245 #endif