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)) return 1;
77 supported_drivers[i].enabled=0;
78 return 0;
79 }
80
81 return FALSE;
82 }
83
84 int
85 sndtable_init_card (int unit, struct address_info *hw_config)
86 {
87 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
88
89 if (!unit)
90 {
91 if (sndtable_init (0) != 0)
92 panic ("snd: Invalid memory allocation\n");
93 return TRUE;
94 }
95
96 for (i = 0; i < (n - 1); i++)
97 if (supported_drivers[i].card_type == unit)
98 {
99 supported_drivers[i].config.io_base = hw_config->io_base;
100 supported_drivers[i].config.irq = hw_config->irq;
101 supported_drivers[i].config.dma = hw_config->dma;
102
103 if (supported_drivers[i].attach (0, hw_config) != 0)
104 panic ("snd#: Invalid memory allocation\n");
105 return TRUE;
106 }
107
108 return FALSE;
109 }
110
111 int
112 sndtable_get_cardcount (void)
113 {
114 return num_dspdevs + num_mixers + num_synths + num_midis;
115 }
116
117 #ifdef linux
118 void sound_setup(char *str, int *ints)
119 {
120 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
121
122
123
124
125
126 for (i=0;i<n;i++)
127 supported_drivers[i].enabled = 0;
128
129 if (ints[0] == 0 || ints[1] == 0) return;
130
131
132
133
134 for (i=1;i<=ints[0];i++)
135 {
136 int card_type, ioaddr, irq, dma, ptr, j;
137 unsigned int val;
138
139 val = (unsigned int)ints[i];
140
141 card_type = (val & 0x0ff00000) >> 20;
142
143 if (card_type > 127)
144 {
145
146 return;
147 }
148
149 ioaddr = (val & 0x000fff00) >> 8;
150 irq = (val & 0x000000f0) >> 4;
151 dma = (val & 0x0000000f);
152
153 ptr = -1;
154 for (j=0;j<n && ptr == -1;j++)
155 if (supported_drivers[j].card_type == card_type)
156 ptr = j;
157
158 if (ptr == -1)
159 printk("Sound: Invalid setup parameter 0x%08x\n", val);
160 else
161 {
162 supported_drivers[ptr].enabled = 1;
163 supported_drivers[ptr].config.io_base = ioaddr;
164 supported_drivers[ptr].config.irq = irq;
165 supported_drivers[ptr].config.dma = dma;
166 }
167 }
168 }
169 #else
170 void sound_chconf(int card_type, int ioaddr, int irq, int dma)
171 {
172 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
173
174 int ptr, j;
175
176 ptr = -1;
177 for (j=0;j<n && ptr == -1;j++)
178 if (supported_drivers[j].card_type == card_type)
179 ptr = j;
180
181 if (ptr != -1)
182 {
183 supported_drivers[ptr].enabled = 1;
184 if (ioaddr) supported_drivers[ptr].config.io_base = ioaddr;
185 if (irq) supported_drivers[ptr].config.irq = irq;
186 if (dma) supported_drivers[ptr].config.dma = dma;
187 }
188 }
189 #endif
190
191 struct address_info *sound_getconf(int card_type)
192 {
193 int j, ptr;
194 int n = sizeof (supported_drivers) / sizeof (struct card_info);
195
196 ptr = -1;
197 for (j=0;j<n && ptr == -1;j++)
198 if (supported_drivers[j].card_type == card_type)
199 ptr = j;
200
201 if (ptr == -1) return (struct address_info *)NULL;
202
203 return &supported_drivers[ptr].config;
204 }
205 #endif