This source file includes following definitions.
- sndtable_init
- sndtable_probe
- sndtable_init_card
- sndtable_get_cardcount
- sound_setup
- 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%3x 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 return mem_start;
58 }
59
60 int
61 sndtable_probe (int unit, struct address_info *hw_config)
62 {
63 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
64
65 if (!unit)
66 return TRUE;
67
68 for (i = 0; i < (n - 1); i++)
69 if (supported_drivers[i].card_type == unit)
70 return supported_drivers[i].probe (hw_config);
71
72 return FALSE;
73 }
74
75 int
76 sndtable_init_card (int unit, struct address_info *hw_config)
77 {
78 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
79
80 if (!unit)
81 {
82 if (sndtable_init (0) != 0)
83 panic ("snd: Invalid memory allocation\n");
84 return TRUE;
85 }
86
87 for (i = 0; i < (n - 1); i++)
88 if (supported_drivers[i].card_type == unit)
89 {
90 if (supported_drivers[i].attach (0, hw_config) != 0)
91 panic ("snd#: Invalid memory allocation\n");
92 return TRUE;
93 }
94
95 return FALSE;
96 }
97
98 int
99 sndtable_get_cardcount (void)
100 {
101 return num_dspdevs + num_mixers + num_synths + num_midis;
102 }
103
104 void sound_setup(char *str, int *ints)
105 {
106 int i, n = sizeof (supported_drivers) / sizeof (struct card_info);
107
108 printk("sound_setup(%d) called\n", ints[0]);
109
110
111
112
113
114 for (i=0;i<n;i++)
115 supported_drivers[i].enabled = 0;
116
117 if (ints[0] == 0 || ints[1] == 0) return;
118
119
120
121
122 for (i=1;i<=ints[0];i++)
123 {
124 int card_type, ioaddr, irq, dma, ptr, j;
125 unsigned int val;
126
127 val = (unsigned int)ints[i];
128
129 card_type = (val & 0x0ff00000) >> 20;
130
131 if (card_type > 127)
132 {
133
134 return;
135 }
136
137 ioaddr = (val & 0x000fff00) >> 8;
138 irq = (val & 0x000000f0) >> 4;
139 dma = (val & 0x0000000f);
140
141 ptr = -1;
142 for (j=0;j<n && ptr == -1;j++)
143 if (supported_drivers[j].card_type == card_type)
144 ptr = j;
145
146 if (ptr == -1)
147 printk("Sound: Invalid setup parameter 0x%08x\n", val);
148 else
149 {
150 supported_drivers[ptr].enabled = 1;
151 supported_drivers[ptr].config.io_base = ioaddr;
152 supported_drivers[ptr].config.irq = irq;
153 supported_drivers[ptr].config.dma = dma;
154 }
155 }
156 }
157
158 struct address_info *sound_getconf(int card_type)
159 {
160 int j, ptr;
161 int n = sizeof (supported_drivers) / sizeof (struct card_info);
162
163 ptr = -1;
164 for (j=0;j<n && ptr == -1;j++)
165 if (supported_drivers[j].card_type == card_type)
166 ptr = j;
167
168 if (ptr == -1) return (struct address_info *)NULL;
169
170 return &supported_drivers[ptr].config;
171 }
172 #endif