This source file includes following definitions.
- sndtable_init
- sndtable_probe
- sndtable_init_card
- sndtable_get_cardcount
- sound_setup
- sound_chconf
- sound_getconf
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 #define _DEV_TABLE_C_
31 #include "sound_config.h"
32
33 #ifdef CONFIGURE_SOUNDCARD
34
35 long
36 sndtable_init (long mem_start)
37 {
38 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
39
40 for (i = 0; i < (n - 1); i++)
41 if (supported_drivers[i].enabled)
42 if (supported_drivers[i].probe (&supported_drivers[i].config))
43 {
44 #ifndef SHORT_BANNERS
45 printk ("snd%d",
46 supported_drivers[i].card_type);
47 #endif
48
49 mem_start = supported_drivers[i].attach (mem_start, &supported_drivers[i].config);
50 #ifndef SHORT_BANNERS
51 printk (" at 0x%x irq %d drq %d\n",
52 supported_drivers[i].config.io_base,
53 supported_drivers[i].config.irq,
54 supported_drivers[i].config.dma);
55 #endif
56 }
57 else
58 supported_drivers[i].enabled = 0;
59 return mem_start;
60 }
61
62 int
63 sndtable_probe (int unit, struct address_info *hw_config)
64 {
65 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
66
67 if (!unit)
68 return TRUE;
69
70 for (i = 0; i < (n - 1); i++)
71 if (supported_drivers[i].card_type == unit)
72 {
73 supported_drivers[i].config.io_base = hw_config->io_base;
74 supported_drivers[i].config.irq = hw_config->irq;
75 supported_drivers[i].config.dma = hw_config->dma;
76 if (supported_drivers[i].probe (hw_config))
77 return 1;
78 supported_drivers[i].enabled = 0;
79 return 0;
80 }
81
82 return FALSE;
83 }
84
85 int
86 sndtable_init_card (int unit, struct address_info *hw_config)
87 {
88 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
89
90 if (!unit)
91 {
92 if (sndtable_init (0) != 0)
93 panic ("snd: Invalid memory allocation\n");
94 return TRUE;
95 }
96
97 for (i = 0; i < (n - 1); i++)
98 if (supported_drivers[i].card_type == unit)
99 {
100 supported_drivers[i].config.io_base = hw_config->io_base;
101 supported_drivers[i].config.irq = hw_config->irq;
102 supported_drivers[i].config.dma = hw_config->dma;
103
104 if (supported_drivers[i].attach (0, hw_config) != 0)
105 panic ("snd#: Invalid memory allocation\n");
106 return TRUE;
107 }
108
109 return FALSE;
110 }
111
112 int
113 sndtable_get_cardcount (void)
114 {
115 return num_dspdevs + num_mixers + num_synths + num_midis;
116 }
117
118 #ifdef linux
119 void
120 sound_setup (char *str, int *ints)
121 {
122 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
123
124
125
126
127
128 for (i = 0; i < n; i++)
129 supported_drivers[i].enabled = 0;
130
131 if (ints[0] == 0 || ints[1] == 0)
132 return;
133
134
135
136
137 for (i = 1; i <= ints[0]; i++)
138 {
139 int card_type, ioaddr, irq, dma, ptr, j;
140 unsigned int val;
141
142 val = (unsigned int) ints[i];
143
144 card_type = (val & 0x0ff00000) >> 20;
145
146 if (card_type > 127)
147 {
148
149 return;
150 }
151
152 ioaddr = (val & 0x000fff00) >> 8;
153 irq = (val & 0x000000f0) >> 4;
154 dma = (val & 0x0000000f);
155
156 ptr = -1;
157 for (j = 0; j < n && ptr == -1; j++)
158 if (supported_drivers[j].card_type == card_type)
159 ptr = j;
160
161 if (ptr == -1)
162 printk ("Sound: Invalid setup parameter 0x%08x\n", val);
163 else
164 {
165 supported_drivers[ptr].enabled = 1;
166 supported_drivers[ptr].config.io_base = ioaddr;
167 supported_drivers[ptr].config.irq = irq;
168 supported_drivers[ptr].config.dma = dma;
169 }
170 }
171 }
172
173 #else
174 void
175 sound_chconf (int card_type, int ioaddr, int irq, int dma)
176 {
177 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
178
179 int ptr, j;
180
181 ptr = -1;
182 for (j = 0; j < n && ptr == -1; j++)
183 if (supported_drivers[j].card_type == card_type)
184 ptr = j;
185
186 if (ptr != -1)
187 {
188 supported_drivers[ptr].enabled = 1;
189 if (ioaddr)
190 supported_drivers[ptr].config.io_base = ioaddr;
191 if (irq)
192 supported_drivers[ptr].config.irq = irq;
193 if (dma)
194 supported_drivers[ptr].config.dma = dma;
195 }
196 }
197
198 #endif
199
200 struct address_info *
201 sound_getconf (int card_type)
202 {
203 int j, ptr;
204 int n = sizeof (supported_drivers) / sizeof (struct card_info);
205
206 ptr = -1;
207 for (j = 0; j < n && ptr == -1; j++)
208 if (supported_drivers[j].card_type == card_type)
209 ptr = j;
210
211 if (ptr == -1)
212 return (struct address_info *) NULL;
213
214 return &supported_drivers[ptr].config;
215 }
216
217 #endif