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
31
32
33
34
35
36
37
38 #include "midi.h"
39 #if NMIDI > 0
40 #include <dev/ic/mpuvar.h>
41 #endif
42
43 #include <sys/timeout.h>
44
45 #define SB_MASTER_VOL 0
46 #define SB_MIDI_VOL 1
47 #define SB_CD_VOL 2
48 #define SB_VOICE_VOL 3
49 #define SB_OUTPUT_CLASS 4
50
51 #define SB_MIC_VOL 5
52 #define SB_LINE_IN_VOL 6
53 #define SB_RECORD_SOURCE 7
54 #define SB_TREBLE 8
55 #define SB_BASS 9
56 #define SB_RECORD_CLASS 10
57 #define SB_INPUT_CLASS 11
58
59 #define SB_PCSPEAKER 12
60 #define SB_INPUT_GAIN 13
61 #define SB_OUTPUT_GAIN 14
62 #define SB_AGC 15
63 #define SB_EQUALIZATION_CLASS 16
64
65 #define SB_CD_IN_MUTE 17
66 #define SB_MIC_IN_MUTE 18
67 #define SB_LINE_IN_MUTE 19
68 #define SB_MIDI_IN_MUTE 20
69
70 #define SB_CD_SWAP 21
71 #define SB_MIC_SWAP 22
72 #define SB_LINE_SWAP 23
73 #define SB_MIDI_SWAP 24
74
75 #define SB_CD_OUT_MUTE 25
76 #define SB_MIC_OUT_MUTE 26
77 #define SB_LINE_OUT_MUTE 27
78
79 #define SB_NDEVS 28
80
81 #define SB_IS_IN_MUTE(x) ((x) < SB_CD_SWAP)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 struct sbdsp_softc {
98 struct device sc_dev;
99 struct isadev sc_id;
100 isa_chipset_tag_t sc_ic;
101 bus_space_tag_t sc_iot;
102 bus_space_handle_t sc_ioh;
103 void *sc_ih;
104 struct device *sc_isa;
105 struct timeout sc_tmo;
106
107 int sc_iobase;
108 int sc_irq;
109 int sc_ist;
110 int sc_drq8;
111 int sc_drq16;
112
113 int sc_open;
114 #define SB_CLOSED 0
115 #define SB_OPEN_AUDIO 1
116 #define SB_OPEN_MIDI 2
117 int sc_openflags;
118 u_char sc_fullduplex;
119
120 u_char gain[SB_NDEVS][2];
121 #define SB_LEFT 0
122 #define SB_RIGHT 1
123 #define SB_LR 0
124
125 u_int in_mask;
126 u_int in_port;
127 u_int in_filter;
128
129 u_int spkr_state;
130
131 struct sbdsp_state {
132 u_int rate;
133 u_char tc;
134 struct sbmode *modep;
135 u_char bmode;
136 int dmachan;
137 int blksize;
138 u_char run;
139 #define SB_NOTRUNNING 0
140 #define SB_RUNNING 3
141 #define SB_LOOPING 2
142 } sc_i, sc_o;
143
144 u_long sc_interrupts;
145
146 int (*sc_intr8)(void *);
147 void *sc_arg8;
148 int (*sc_intr16)(void *);
149 void *sc_arg16;
150 void (*sc_intrp)(void *);
151 void *sc_argp;
152 void (*sc_intrr)(void *);
153 void *sc_argr;
154 void (*sc_intrm)(void *, int);
155 void *sc_argm;
156
157 u_int sc_mixer_model;
158 #define SBM_NONE 0
159 #define SBM_CT1335 1
160 #define SBM_CT1345 2
161 #define SBM_CT1XX5 3
162 #define SBM_CT1745 4
163 #define ISSBM1745(x) ((x)->sc_mixer_model >= SBM_CT1XX5)
164
165 u_int sc_model;
166 #define SB_UNK -1
167 #define SB_1 0
168 #define SB_20 1
169 #define SB_2x 2
170 #define SB_PRO 3
171 #define SB_JAZZ 4
172 #define SB_16 5
173 #define SB_32 6
174 #define SB_64 7
175
176 #define SB_NAMES { "SB_1", "SB_2.0", "SB_2.x", "SB_Pro", "Jazz_16", "SB_16", "SB_AWE_32", "SB_AWE_64" }
177
178 u_int sc_version;
179 #define SBVER_MAJOR(v) (((v)>>8) & 0xff)
180 #define SBVER_MINOR(v) ((v)&0xff)
181
182 #if NMIDI > 0
183 int sc_hasmpu;
184 struct mpu_softc sc_mpu_sc;
185 #endif
186 };
187
188 #define ISSBPRO(sc) ((sc)->sc_model == SB_PRO || (sc)->sc_model == SB_JAZZ)
189 #define ISSBPROCLASS(sc) ((sc)->sc_model >= SB_PRO)
190 #define ISSB16CLASS(sc) ((sc)->sc_model >= SB_16)
191
192 #ifdef _KERNEL
193 int sbdsp_open(void *, int);
194 void sbdsp_close(void *);
195
196 int sbdsp_probe(struct sbdsp_softc *);
197 void sbdsp_attach(struct sbdsp_softc *);
198
199 int sbdsp_set_in_gain(void *, u_int, u_char);
200 int sbdsp_set_in_gain_real(void *, u_int, u_char);
201 int sbdsp_get_in_gain(void *);
202 int sbdsp_set_out_gain(void *, u_int, u_char);
203 int sbdsp_set_out_gain_real(void *, u_int, u_char);
204 int sbdsp_get_out_gain(void *);
205 int sbdsp_set_monitor_gain(void *, u_int);
206 int sbdsp_get_monitor_gain(void *);
207 int sbdsp_query_encoding(void *, struct audio_encoding *);
208 int sbdsp_set_params(void *, int, int, struct audio_params *, struct audio_params *);
209 int sbdsp_round_blocksize(void *, int);
210 int sbdsp_get_avail_in_ports(void *);
211 int sbdsp_get_avail_out_ports(void *);
212 int sbdsp_speaker_ctl(void *, int);
213
214 int sbdsp_commit(void *);
215 int sbdsp_trigger_output(void *, void *, void *, int, void (*)(void *),
216 void *, struct audio_params *);
217 int sbdsp_trigger_input(void *, void *, void *, int, void (*)(void *),
218 void *, struct audio_params *);
219
220 int sbdsp_haltdma(void *);
221
222 void sbdsp_compress(int, u_char *, int);
223 void sbdsp_expand(int, u_char *, int);
224
225 int sbdsp_reset(struct sbdsp_softc *);
226 void sbdsp_spkron(struct sbdsp_softc *);
227 void sbdsp_spkroff(struct sbdsp_softc *);
228
229 int sbdsp_wdsp(struct sbdsp_softc *, int v);
230 int sbdsp_rdsp(struct sbdsp_softc *);
231
232 int sbdsp_intr(void *);
233
234 int sbdsp_set_sr(struct sbdsp_softc *, u_long *, int);
235
236 void sbdsp_mix_write(struct sbdsp_softc *, int, int);
237 int sbdsp_mix_read(struct sbdsp_softc *, int);
238
239 int sbdsp_mixer_set_port(void *, mixer_ctrl_t *);
240 int sbdsp_mixer_get_port(void *, mixer_ctrl_t *);
241 int sbdsp_mixer_query_devinfo(void *, mixer_devinfo_t *);
242
243 void *sb_malloc(void *, int, size_t, int, int);
244 void sb_free(void *, void *, int);
245 size_t sb_round(void *, int, size_t);
246 paddr_t sb_mappage(void *, void *, off_t, int);
247
248 int sbdsp_get_props(void *);
249
250
251 int sbdsp_midi_open(void *, int,
252 void (*iintr)(void *, int),
253 void (*ointr)(void *), void *arg);
254 void sbdsp_midi_close(void *);
255 int sbdsp_midi_output(void *, int);
256 void sbdsp_midi_getinfo(void *, struct midi_info *);
257 #endif