~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/oss/msnd.h

Version: ~ [ linux-5.12 ] ~ [ linux-5.11.16 ] ~ [ linux-5.10.32 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.114 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.188 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.231 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.267 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.267 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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  ********************************************************************/
 28 #ifndef __MSND_H
 29 #define __MSND_H
 30 
 31 #define VERSION                 "0.8.3.1"
 32 
 33 #define DEFSAMPLERATE           DSP_DEFAULT_SPEED
 34 #define DEFSAMPLESIZE           AFMT_U8
 35 #define DEFCHANNELS             1
 36 
 37 #define DEFFIFOSIZE             128
 38 
 39 #define SNDCARD_MSND            38
 40 
 41 #define SRAM_BANK_SIZE          0x8000
 42 #define SRAM_CNTL_START         0x7F00
 43 
 44 #define DSP_BASE_ADDR           0x4000
 45 #define DSP_BANK_BASE           0x4000
 46 
 47 #define HP_ICR                  0x00
 48 #define HP_CVR                  0x01
 49 #define HP_ISR                  0x02
 50 #define HP_IVR                  0x03
 51 #define HP_NU                   0x04
 52 #define HP_INFO                 0x04
 53 #define HP_TXH                  0x05
 54 #define HP_RXH                  0x05
 55 #define HP_TXM                  0x06
 56 #define HP_RXM                  0x06
 57 #define HP_TXL                  0x07
 58 #define HP_RXL                  0x07
 59 
 60 #define HP_ICR_DEF              0x00
 61 #define HP_CVR_DEF              0x12
 62 #define HP_ISR_DEF              0x06
 63 #define HP_IVR_DEF              0x0f
 64 #define HP_NU_DEF               0x00
 65 
 66 #define HP_IRQM                 0x09
 67 
 68 #define HPR_BLRC                0x08
 69 #define HPR_SPR1                0x09
 70 #define HPR_SPR2                0x0A
 71 #define HPR_TCL0                0x0B
 72 #define HPR_TCL1                0x0C
 73 #define HPR_TCL2                0x0D
 74 #define HPR_TCL3                0x0E
 75 #define HPR_TCL4                0x0F
 76 
 77 #define HPICR_INIT              0x80
 78 #define HPICR_HM1               0x40
 79 #define HPICR_HM0               0x20
 80 #define HPICR_HF1               0x10
 81 #define HPICR_HF0               0x08
 82 #define HPICR_TREQ              0x02
 83 #define HPICR_RREQ              0x01
 84 
 85 #define HPCVR_HC                0x80
 86 
 87 #define HPISR_HREQ              0x80
 88 #define HPISR_DMA               0x40
 89 #define HPISR_HF3               0x10
 90 #define HPISR_HF2               0x08
 91 #define HPISR_TRDY              0x04
 92 #define HPISR_TXDE              0x02
 93 #define HPISR_RXDF              0x01
 94 
 95 #define HPIO_290                0
 96 #define HPIO_260                1
 97 #define HPIO_250                2
 98 #define HPIO_240                3
 99 #define HPIO_230                4
100 #define HPIO_220                5
101 #define HPIO_210                6
102 #define HPIO_3E0                7
103 
104 #define HPMEM_NONE              0
105 #define HPMEM_B000              1
106 #define HPMEM_C800              2
107 #define HPMEM_D000              3
108 #define HPMEM_D400              4
109 #define HPMEM_D800              5
110 #define HPMEM_E000              6
111 #define HPMEM_E800              7
112 
113 #define HPIRQ_NONE              0
114 #define HPIRQ_5                 1
115 #define HPIRQ_7                 2
116 #define HPIRQ_9                 3
117 #define HPIRQ_10                4
118 #define HPIRQ_11                5
119 #define HPIRQ_12                6
120 #define HPIRQ_15                7
121 
122 #define HIMT_PLAY_DONE          0x00
123 #define HIMT_RECORD_DONE        0x01
124 #define HIMT_MIDI_EOS           0x02
125 #define HIMT_MIDI_OUT           0x03
126 
127 #define HIMT_MIDI_IN_UCHAR      0x0E
128 #define HIMT_DSP                0x0F
129 
130 #define HDEX_BASE               0x92
131 #define HDEX_PLAY_START         (0 + HDEX_BASE)
132 #define HDEX_PLAY_STOP          (1 + HDEX_BASE)
133 #define HDEX_PLAY_PAUSE         (2 + HDEX_BASE)
134 #define HDEX_PLAY_RESUME        (3 + HDEX_BASE)
135 #define HDEX_RECORD_START       (4 + HDEX_BASE)
136 #define HDEX_RECORD_STOP        (5 + HDEX_BASE)
137 #define HDEX_MIDI_IN_START      (6 + HDEX_BASE)
138 #define HDEX_MIDI_IN_STOP       (7 + HDEX_BASE)
139 #define HDEX_MIDI_OUT_START     (8 + HDEX_BASE)
140 #define HDEX_MIDI_OUT_STOP      (9 + HDEX_BASE)
141 #define HDEX_AUX_REQ            (10 + HDEX_BASE)
142 
143 #define HIWORD(l)               ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF))
144 #define LOWORD(l)               ((WORD)(DWORD)(l))
145 #define HIBYTE(w)               ((BYTE)(((WORD)(w) >> 8) & 0xFF))
146 #define LOBYTE(w)               ((BYTE)(w))
147 #define MAKELONG(low,hi)        ((long)(((WORD)(low))|(((DWORD)((WORD)(hi)))<<16)))
148 #define MAKEWORD(low,hi)        ((WORD)(((BYTE)(low))|(((WORD)((BYTE)(hi)))<<8)))
149 
150 #define PCTODSP_OFFSET(w)       (USHORT)((w)/2)
151 #define PCTODSP_BASED(w)        (USHORT)(((w)/2) + DSP_BASE_ADDR)
152 #define DSPTOPC_BASED(w)        (((w) - DSP_BASE_ADDR) * 2)
153 
154 #ifdef SLOWIO
155 #define msnd_outb                       outb_p
156 #define msnd_inb                        inb_p
157 #else
158 #define msnd_outb                       outb
159 #define msnd_inb                        inb
160 #endif
161 
162 /* JobQueueStruct */
163 #define JQS_wStart              0x00
164 #define JQS_wSize               0x02
165 #define JQS_wHead               0x04
166 #define JQS_wTail               0x06
167 #define JQS__size               0x08
168 
169 /* DAQueueDataStruct */
170 #define DAQDS_wStart            0x00
171 #define DAQDS_wSize             0x02
172 #define DAQDS_wFormat           0x04
173 #define DAQDS_wSampleSize       0x06
174 #define DAQDS_wChannels         0x08
175 #define DAQDS_wSampleRate       0x0A
176 #define DAQDS_wIntMsg           0x0C
177 #define DAQDS_wFlags            0x0E
178 #define DAQDS__size             0x10
179 
180 typedef u8                      BYTE;
181 typedef u16                     USHORT;
182 typedef u16                     WORD;
183 typedef u32                     DWORD;
184 typedef void __iomem *          LPDAQD;
185 
186 /* Generic FIFO */
187 typedef struct {
188         size_t n, len;
189         char *data;
190         int head, tail;
191 } msnd_fifo;
192 
193 typedef struct multisound_dev {
194         /* Linux device info */
195         char *name;
196         int dsp_minor, mixer_minor;
197         int ext_midi_dev, hdr_midi_dev;
198 
199         /* Hardware resources */
200         int io, numio;
201         int memid, irqid;
202         int irq, irq_ref;
203         unsigned char info;
204         void __iomem *base;
205 
206         /* Motorola 56k DSP SMA */
207         void __iomem *SMA;
208         void __iomem *DAPQ, *DARQ, *MODQ, *MIDQ, *DSPQ;
209         void __iomem *pwDSPQData, *pwMIDQData, *pwMODQData;
210         int dspq_data_buff, dspq_buff_size;
211 
212         /* State variables */
213         enum { msndClassic, msndPinnacle } type;
214         fmode_t mode;
215         unsigned long flags;
216 #define F_RESETTING                     0
217 #define F_HAVEDIGITAL                   1
218 #define F_AUDIO_WRITE_INUSE             2
219 #define F_WRITING                       3
220 #define F_WRITEBLOCK                    4
221 #define F_WRITEFLUSH                    5
222 #define F_AUDIO_READ_INUSE              6
223 #define F_READING                       7
224 #define F_READBLOCK                     8
225 #define F_EXT_MIDI_INUSE                9
226 #define F_HDR_MIDI_INUSE                10
227 #define F_DISABLE_WRITE_NDELAY          11
228         wait_queue_head_t writeblock;
229         wait_queue_head_t readblock;
230         wait_queue_head_t writeflush;
231         spinlock_t lock;
232         int nresets;
233         unsigned long recsrc;
234         int left_levels[32];
235         int right_levels[32];
236         int mixer_mod_count;
237         int calibrate_signal;
238         int play_sample_size, play_sample_rate, play_channels;
239         int play_ndelay;
240         int rec_sample_size, rec_sample_rate, rec_channels;
241         int rec_ndelay;
242         BYTE bCurrentMidiPatch;
243 
244         /* Digital audio FIFOs */
245         msnd_fifo DAPF, DARF;
246         int fifosize;
247         int last_playbank, last_recbank;
248 
249         /* MIDI in callback */
250         void (*midi_in_interrupt)(struct multisound_dev *);
251 } multisound_dev_t;
252 
253 #ifndef mdelay
254 #  define mdelay(a)             udelay((a) * 1000)
255 #endif
256 
257 int                             msnd_register(multisound_dev_t *dev);
258 void                            msnd_unregister(multisound_dev_t *dev);
259 
260 void                            msnd_init_queue(void __iomem *, int start, int size);
261 
262 void                            msnd_fifo_init(msnd_fifo *f);
263 void                            msnd_fifo_free(msnd_fifo *f);
264 int                             msnd_fifo_alloc(msnd_fifo *f, size_t n);
265 void                            msnd_fifo_make_empty(msnd_fifo *f);
266 int                             msnd_fifo_write_io(msnd_fifo *f, char __iomem *buf, size_t len);
267 int                             msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len);
268 int                             msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len);
269 int                             msnd_fifo_read(msnd_fifo *f, char *buf, size_t len);
270 
271 int                             msnd_send_dsp_cmd(multisound_dev_t *dev, BYTE cmd);
272 int                             msnd_send_word(multisound_dev_t *dev, unsigned char high,
273                                                unsigned char mid, unsigned char low);
274 int                             msnd_upload_host(multisound_dev_t *dev, char *bin, int len);
275 int                             msnd_enable_irq(multisound_dev_t *dev);
276 int                             msnd_disable_irq(multisound_dev_t *dev);
277 
278 #endif /* __MSND_H */
279 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp