diff options
Diffstat (limited to 'sound/oss/msnd.h')
-rw-r--r-- | sound/oss/msnd.h | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/sound/oss/msnd.h b/sound/oss/msnd.h new file mode 100644 index 000000000000..05cf7865be5e --- /dev/null +++ b/sound/oss/msnd.h | |||
@@ -0,0 +1,280 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * msnd.h | ||
4 | * | ||
5 | * Turtle Beach MultiSound Sound Card Driver for Linux | ||
6 | * | ||
7 | * Some parts of this header file were derived from the Turtle Beach | ||
8 | * MultiSound Driver Development Kit. | ||
9 | * | ||
10 | * Copyright (C) 1998 Andrew Veliath | ||
11 | * Copyright (C) 1993 Turtle Beach Systems, Inc. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | * | ||
27 | * $Id: msnd.h,v 1.36 1999/03/21 17:05:42 andrewtv Exp $ | ||
28 | * | ||
29 | ********************************************************************/ | ||
30 | #ifndef __MSND_H | ||
31 | #define __MSND_H | ||
32 | |||
33 | #define VERSION "0.8.3.1" | ||
34 | |||
35 | #define DEFSAMPLERATE DSP_DEFAULT_SPEED | ||
36 | #define DEFSAMPLESIZE AFMT_U8 | ||
37 | #define DEFCHANNELS 1 | ||
38 | |||
39 | #define DEFFIFOSIZE 128 | ||
40 | |||
41 | #define SNDCARD_MSND 38 | ||
42 | |||
43 | #define SRAM_BANK_SIZE 0x8000 | ||
44 | #define SRAM_CNTL_START 0x7F00 | ||
45 | |||
46 | #define DSP_BASE_ADDR 0x4000 | ||
47 | #define DSP_BANK_BASE 0x4000 | ||
48 | |||
49 | #define HP_ICR 0x00 | ||
50 | #define HP_CVR 0x01 | ||
51 | #define HP_ISR 0x02 | ||
52 | #define HP_IVR 0x03 | ||
53 | #define HP_NU 0x04 | ||
54 | #define HP_INFO 0x04 | ||
55 | #define HP_TXH 0x05 | ||
56 | #define HP_RXH 0x05 | ||
57 | #define HP_TXM 0x06 | ||
58 | #define HP_RXM 0x06 | ||
59 | #define HP_TXL 0x07 | ||
60 | #define HP_RXL 0x07 | ||
61 | |||
62 | #define HP_ICR_DEF 0x00 | ||
63 | #define HP_CVR_DEF 0x12 | ||
64 | #define HP_ISR_DEF 0x06 | ||
65 | #define HP_IVR_DEF 0x0f | ||
66 | #define HP_NU_DEF 0x00 | ||
67 | |||
68 | #define HP_IRQM 0x09 | ||
69 | |||
70 | #define HPR_BLRC 0x08 | ||
71 | #define HPR_SPR1 0x09 | ||
72 | #define HPR_SPR2 0x0A | ||
73 | #define HPR_TCL0 0x0B | ||
74 | #define HPR_TCL1 0x0C | ||
75 | #define HPR_TCL2 0x0D | ||
76 | #define HPR_TCL3 0x0E | ||
77 | #define HPR_TCL4 0x0F | ||
78 | |||
79 | #define HPICR_INIT 0x80 | ||
80 | #define HPICR_HM1 0x40 | ||
81 | #define HPICR_HM0 0x20 | ||
82 | #define HPICR_HF1 0x10 | ||
83 | #define HPICR_HF0 0x08 | ||
84 | #define HPICR_TREQ 0x02 | ||
85 | #define HPICR_RREQ 0x01 | ||
86 | |||
87 | #define HPCVR_HC 0x80 | ||
88 | |||
89 | #define HPISR_HREQ 0x80 | ||
90 | #define HPISR_DMA 0x40 | ||
91 | #define HPISR_HF3 0x10 | ||
92 | #define HPISR_HF2 0x08 | ||
93 | #define HPISR_TRDY 0x04 | ||
94 | #define HPISR_TXDE 0x02 | ||
95 | #define HPISR_RXDF 0x01 | ||
96 | |||
97 | #define HPIO_290 0 | ||
98 | #define HPIO_260 1 | ||
99 | #define HPIO_250 2 | ||
100 | #define HPIO_240 3 | ||
101 | #define HPIO_230 4 | ||
102 | #define HPIO_220 5 | ||
103 | #define HPIO_210 6 | ||
104 | #define HPIO_3E0 7 | ||
105 | |||
106 | #define HPMEM_NONE 0 | ||
107 | #define HPMEM_B000 1 | ||
108 | #define HPMEM_C800 2 | ||
109 | #define HPMEM_D000 3 | ||
110 | #define HPMEM_D400 4 | ||
111 | #define HPMEM_D800 5 | ||
112 | #define HPMEM_E000 6 | ||
113 | #define HPMEM_E800 7 | ||
114 | |||
115 | #define HPIRQ_NONE 0 | ||
116 | #define HPIRQ_5 1 | ||
117 | #define HPIRQ_7 2 | ||
118 | #define HPIRQ_9 3 | ||
119 | #define HPIRQ_10 4 | ||
120 | #define HPIRQ_11 5 | ||
121 | #define HPIRQ_12 6 | ||
122 | #define HPIRQ_15 7 | ||
123 | |||
124 | #define HIMT_PLAY_DONE 0x00 | ||
125 | #define HIMT_RECORD_DONE 0x01 | ||
126 | #define HIMT_MIDI_EOS 0x02 | ||
127 | #define HIMT_MIDI_OUT 0x03 | ||
128 | |||
129 | #define HIMT_MIDI_IN_UCHAR 0x0E | ||
130 | #define HIMT_DSP 0x0F | ||
131 | |||
132 | #define HDEX_BASE 0x92 | ||
133 | #define HDEX_PLAY_START (0 + HDEX_BASE) | ||
134 | #define HDEX_PLAY_STOP (1 + HDEX_BASE) | ||
135 | #define HDEX_PLAY_PAUSE (2 + HDEX_BASE) | ||
136 | #define HDEX_PLAY_RESUME (3 + HDEX_BASE) | ||
137 | #define HDEX_RECORD_START (4 + HDEX_BASE) | ||
138 | #define HDEX_RECORD_STOP (5 + HDEX_BASE) | ||
139 | #define HDEX_MIDI_IN_START (6 + HDEX_BASE) | ||
140 | #define HDEX_MIDI_IN_STOP (7 + HDEX_BASE) | ||
141 | #define HDEX_MIDI_OUT_START (8 + HDEX_BASE) | ||
142 | #define HDEX_MIDI_OUT_STOP (9 + HDEX_BASE) | ||
143 | #define HDEX_AUX_REQ (10 + HDEX_BASE) | ||
144 | |||
145 | #define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF)) | ||
146 | #define LOWORD(l) ((WORD)(DWORD)(l)) | ||
147 | #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) | ||
148 | #define LOBYTE(w) ((BYTE)(w)) | ||
149 | #define MAKELONG(low,hi) ((long)(((WORD)(low))|(((DWORD)((WORD)(hi)))<<16))) | ||
150 | #define MAKEWORD(low,hi) ((WORD)(((BYTE)(low))|(((WORD)((BYTE)(hi)))<<8))) | ||
151 | |||
152 | #define PCTODSP_OFFSET(w) (USHORT)((w)/2) | ||
153 | #define PCTODSP_BASED(w) (USHORT)(((w)/2) + DSP_BASE_ADDR) | ||
154 | #define DSPTOPC_BASED(w) (((w) - DSP_BASE_ADDR) * 2) | ||
155 | |||
156 | #ifdef SLOWIO | ||
157 | #define msnd_outb outb_p | ||
158 | #define msnd_inb inb_p | ||
159 | #else | ||
160 | #define msnd_outb outb | ||
161 | #define msnd_inb inb | ||
162 | #endif | ||
163 | |||
164 | /* JobQueueStruct */ | ||
165 | #define JQS_wStart 0x00 | ||
166 | #define JQS_wSize 0x02 | ||
167 | #define JQS_wHead 0x04 | ||
168 | #define JQS_wTail 0x06 | ||
169 | #define JQS__size 0x08 | ||
170 | |||
171 | /* DAQueueDataStruct */ | ||
172 | #define DAQDS_wStart 0x00 | ||
173 | #define DAQDS_wSize 0x02 | ||
174 | #define DAQDS_wFormat 0x04 | ||
175 | #define DAQDS_wSampleSize 0x06 | ||
176 | #define DAQDS_wChannels 0x08 | ||
177 | #define DAQDS_wSampleRate 0x0A | ||
178 | #define DAQDS_wIntMsg 0x0C | ||
179 | #define DAQDS_wFlags 0x0E | ||
180 | #define DAQDS__size 0x10 | ||
181 | |||
182 | typedef u8 BYTE; | ||
183 | typedef u16 USHORT; | ||
184 | typedef u16 WORD; | ||
185 | typedef u32 DWORD; | ||
186 | typedef void __iomem * LPDAQD; | ||
187 | |||
188 | /* Generic FIFO */ | ||
189 | typedef struct { | ||
190 | size_t n, len; | ||
191 | char *data; | ||
192 | int head, tail; | ||
193 | } msnd_fifo; | ||
194 | |||
195 | typedef struct multisound_dev { | ||
196 | /* Linux device info */ | ||
197 | char *name; | ||
198 | int dsp_minor, mixer_minor; | ||
199 | int ext_midi_dev, hdr_midi_dev; | ||
200 | |||
201 | /* Hardware resources */ | ||
202 | int io, numio; | ||
203 | int memid, irqid; | ||
204 | int irq, irq_ref; | ||
205 | unsigned char info; | ||
206 | void __iomem *base; | ||
207 | |||
208 | /* Motorola 56k DSP SMA */ | ||
209 | void __iomem *SMA; | ||
210 | void __iomem *DAPQ, *DARQ, *MODQ, *MIDQ, *DSPQ; | ||
211 | void __iomem *pwDSPQData, *pwMIDQData, *pwMODQData; | ||
212 | int dspq_data_buff, dspq_buff_size; | ||
213 | |||
214 | /* State variables */ | ||
215 | enum { msndClassic, msndPinnacle } type; | ||
216 | mode_t mode; | ||
217 | unsigned long flags; | ||
218 | #define F_RESETTING 0 | ||
219 | #define F_HAVEDIGITAL 1 | ||
220 | #define F_AUDIO_WRITE_INUSE 2 | ||
221 | #define F_WRITING 3 | ||
222 | #define F_WRITEBLOCK 4 | ||
223 | #define F_WRITEFLUSH 5 | ||
224 | #define F_AUDIO_READ_INUSE 6 | ||
225 | #define F_READING 7 | ||
226 | #define F_READBLOCK 8 | ||
227 | #define F_EXT_MIDI_INUSE 9 | ||
228 | #define F_HDR_MIDI_INUSE 10 | ||
229 | #define F_DISABLE_WRITE_NDELAY 11 | ||
230 | wait_queue_head_t writeblock; | ||
231 | wait_queue_head_t readblock; | ||
232 | wait_queue_head_t writeflush; | ||
233 | spinlock_t lock; | ||
234 | int nresets; | ||
235 | unsigned long recsrc; | ||
236 | int left_levels[16]; | ||
237 | int right_levels[16]; | ||
238 | int mixer_mod_count; | ||
239 | int calibrate_signal; | ||
240 | int play_sample_size, play_sample_rate, play_channels; | ||
241 | int play_ndelay; | ||
242 | int rec_sample_size, rec_sample_rate, rec_channels; | ||
243 | int rec_ndelay; | ||
244 | BYTE bCurrentMidiPatch; | ||
245 | |||
246 | /* Digital audio FIFOs */ | ||
247 | msnd_fifo DAPF, DARF; | ||
248 | int fifosize; | ||
249 | int last_playbank, last_recbank; | ||
250 | |||
251 | /* MIDI in callback */ | ||
252 | void (*midi_in_interrupt)(struct multisound_dev *); | ||
253 | } multisound_dev_t; | ||
254 | |||
255 | #ifndef mdelay | ||
256 | # define mdelay(a) udelay((a) * 1000) | ||
257 | #endif | ||
258 | |||
259 | int msnd_register(multisound_dev_t *dev); | ||
260 | void msnd_unregister(multisound_dev_t *dev); | ||
261 | |||
262 | void msnd_init_queue(void __iomem *, int start, int size); | ||
263 | |||
264 | void msnd_fifo_init(msnd_fifo *f); | ||
265 | void msnd_fifo_free(msnd_fifo *f); | ||
266 | int msnd_fifo_alloc(msnd_fifo *f, size_t n); | ||
267 | void msnd_fifo_make_empty(msnd_fifo *f); | ||
268 | int msnd_fifo_write_io(msnd_fifo *f, char __iomem *buf, size_t len); | ||
269 | int msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len); | ||
270 | int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len); | ||
271 | int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len); | ||
272 | |||
273 | int msnd_send_dsp_cmd(multisound_dev_t *dev, BYTE cmd); | ||
274 | int msnd_send_word(multisound_dev_t *dev, unsigned char high, | ||
275 | unsigned char mid, unsigned char low); | ||
276 | int msnd_upload_host(multisound_dev_t *dev, char *bin, int len); | ||
277 | int msnd_enable_irq(multisound_dev_t *dev); | ||
278 | int msnd_disable_irq(multisound_dev_t *dev); | ||
279 | |||
280 | #endif /* __MSND_H */ | ||