Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux/fpc-iii.git] / sound / oss / dev_table.h
blob0199a317c5a9a5d2d180ad9f5ab03a6b048a0066
1 /*
2 * dev_table.h
4 * Global definitions for device call tables
7 * Copyright (C) by Hannu Savolainen 1993-1997
9 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
10 * Version 2 (June 1991). See the "COPYING" file distributed with this software
11 * for more info.
15 #ifndef _DEV_TABLE_H_
16 #define _DEV_TABLE_H_
18 #include <linux/spinlock.h>
20 * Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
21 * Numbers 1000 to N are reserved for driver's internal use.
24 #define SNDCARD_DESKPROXL 27 /* Compaq Deskpro XL */
25 #define SNDCARD_VIDC 28 /* ARMs VIDC */
26 #define SNDCARD_SBPNP 29
27 #define SNDCARD_SOFTOSS 36
28 #define SNDCARD_VMIDI 37
29 #define SNDCARD_OPL3SA1 38 /* Note: clash in msnd.h */
30 #define SNDCARD_OPL3SA1_SB 39
31 #define SNDCARD_OPL3SA1_MPU 40
32 #define SNDCARD_WAVEFRONT 41
33 #define SNDCARD_OPL3SA2 42
34 #define SNDCARD_OPL3SA2_MPU 43
35 #define SNDCARD_WAVEARTIST 44 /* Waveartist */
36 #define SNDCARD_OPL3SA2_MSS 45 /* Originally missed */
37 #define SNDCARD_AD1816 88
40 * NOTE! NOTE! NOTE! NOTE!
42 * If you modify this file, please check the dev_table.c also.
44 * NOTE! NOTE! NOTE! NOTE!
47 struct driver_info
49 char *driver_id;
50 int card_subtype; /* Driver specific. Usually 0 */
51 int card_type; /* From soundcard.h */
52 char *name;
53 void (*attach) (struct address_info *hw_config);
54 int (*probe) (struct address_info *hw_config);
55 void (*unload) (struct address_info *hw_config);
58 struct card_info
60 int card_type; /* Link (search key) to the driver list */
61 struct address_info config;
62 int enabled;
63 void *for_driver_use;
68 * Device specific parameters (used only by dmabuf.c)
70 #define MAX_SUB_BUFFERS (32*MAX_REALTIME_FACTOR)
72 #define DMODE_NONE 0
73 #define DMODE_OUTPUT PCM_ENABLE_OUTPUT
74 #define DMODE_INPUT PCM_ENABLE_INPUT
76 struct dma_buffparms
78 int dma_mode; /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
79 int closing;
82 * Pointers to raw buffers
85 char *raw_buf;
86 unsigned long raw_buf_phys;
87 int buffsize;
90 * Device state tables
93 unsigned long flags;
94 #define DMA_BUSY 0x00000001
95 #define DMA_RESTART 0x00000002
96 #define DMA_ACTIVE 0x00000004
97 #define DMA_STARTED 0x00000008
98 #define DMA_EMPTY 0x00000010
99 #define DMA_ALLOC_DONE 0x00000020
100 #define DMA_SYNCING 0x00000040
101 #define DMA_DIRTY 0x00000080
102 #define DMA_POST 0x00000100
103 #define DMA_NODMA 0x00000200
104 #define DMA_NOTIMEOUT 0x00000400
106 int open_mode;
109 * Queue parameters.
111 int qlen;
112 int qhead;
113 int qtail;
114 spinlock_t lock;
116 int cfrag; /* Current incomplete fragment (write) */
118 int nbufs;
119 int counts[MAX_SUB_BUFFERS];
120 int subdivision;
122 int fragment_size;
123 int needs_reorg;
124 int max_fragments;
126 int bytes_in_use;
128 int underrun_count;
129 unsigned long byte_counter;
130 unsigned long user_counter;
131 unsigned long max_byte_counter;
132 int data_rate; /* Bytes/second */
134 int mapping_flags;
135 #define DMA_MAP_MAPPED 0x00000001
136 char neutral_byte;
137 int dma; /* DMA channel */
139 int applic_profile; /* Application profile (APF_*) */
140 /* Interrupt callback stuff */
141 void (*audio_callback) (int dev, int parm);
142 int callback_parm;
144 int buf_flags[MAX_SUB_BUFFERS];
145 #define BUFF_EOF 0x00000001 /* Increment eof count */
146 #define BUFF_DIRTY 0x00000002 /* Buffer written */
150 * Structure for use with various microcontrollers and DSP processors
151 * in the recent sound cards.
153 typedef struct coproc_operations
155 char name[64];
156 struct module *owner;
157 int (*open) (void *devc, int sub_device);
158 void (*close) (void *devc, int sub_device);
159 int (*ioctl) (void *devc, unsigned int cmd, void __user * arg, int local);
160 void (*reset) (void *devc);
162 void *devc; /* Driver specific info */
163 } coproc_operations;
165 struct audio_driver
167 struct module *owner;
168 int (*open) (int dev, int mode);
169 void (*close) (int dev);
170 void (*output_block) (int dev, unsigned long buf,
171 int count, int intrflag);
172 void (*start_input) (int dev, unsigned long buf,
173 int count, int intrflag);
174 int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
175 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
176 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
177 void (*halt_io) (int dev);
178 int (*local_qlen)(int dev);
179 void (*copy_user) (int dev,
180 char *localbuf, int localoffs,
181 const char __user *userbuf, int useroffs,
182 int max_in, int max_out,
183 int *used, int *returned,
184 int len);
185 void (*halt_input) (int dev);
186 void (*halt_output) (int dev);
187 void (*trigger) (int dev, int bits);
188 int (*set_speed)(int dev, int speed);
189 unsigned int (*set_bits)(int dev, unsigned int bits);
190 short (*set_channels)(int dev, short channels);
191 void (*postprocess_write)(int dev); /* Device spesific postprocessing for written data */
192 void (*preprocess_read)(int dev); /* Device spesific preprocessing for read data */
193 void (*mmap)(int dev);
196 struct audio_operations
198 char name[128];
199 int flags;
200 #define NOTHING_SPECIAL 0x00
201 #define NEEDS_RESTART 0x01
202 #define DMA_AUTOMODE 0x02
203 #define DMA_DUPLEX 0x04
204 #define DMA_PSEUDO_AUTOMODE 0x08
205 #define DMA_HARDSTOP 0x10
206 #define DMA_EXACT 0x40
207 #define DMA_NORESET 0x80
208 int format_mask; /* Bitmask for supported audio formats */
209 void *devc; /* Driver specific info */
210 struct audio_driver *d;
211 void *portc; /* Driver specific info */
212 struct dma_buffparms *dmap_in, *dmap_out;
213 struct coproc_operations *coproc;
214 int mixer_dev;
215 int enable_bits;
216 int open_mode;
217 int go;
218 int min_fragment; /* 0 == unlimited */
219 int max_fragment; /* 0 == unlimited */
220 int parent_dev; /* 0 -> no parent, 1 to n -> parent=parent_dev+1 */
222 /* fields formerly in dmabuf.c */
223 wait_queue_head_t in_sleeper;
224 wait_queue_head_t out_sleeper;
225 wait_queue_head_t poll_sleeper;
227 /* fields formerly in audio.c */
228 int audio_mode;
230 #define AM_NONE 0
231 #define AM_WRITE OPEN_WRITE
232 #define AM_READ OPEN_READ
234 int local_format;
235 int audio_format;
236 int local_conversion;
237 #define CNV_MU_LAW 0x00000001
239 /* large structures at the end to keep offsets small */
240 struct dma_buffparms dmaps[2];
243 int *load_mixer_volumes(char *name, int *levels, int present);
245 struct mixer_operations
247 struct module *owner;
248 char id[16];
249 char name[64];
250 int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
252 void *devc;
253 int modify_counter;
256 struct synth_operations
258 struct module *owner;
259 char *id; /* Unique identifier (ASCII) max 29 char */
260 struct synth_info *info;
261 int midi_dev;
262 int synth_type;
263 int synth_subtype;
265 int (*open) (int dev, int mode);
266 void (*close) (int dev);
267 int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
268 int (*kill_note) (int dev, int voice, int note, int velocity);
269 int (*start_note) (int dev, int voice, int note, int velocity);
270 int (*set_instr) (int dev, int voice, int instr);
271 void (*reset) (int dev);
272 void (*hw_control) (int dev, unsigned char *event);
273 int (*load_patch) (int dev, int format, const char __user *addr,
274 int count, int pmgr_flag);
275 void (*aftertouch) (int dev, int voice, int pressure);
276 void (*controller) (int dev, int voice, int ctrl_num, int value);
277 void (*panning) (int dev, int voice, int value);
278 void (*volume_method) (int dev, int mode);
279 void (*bender) (int dev, int chn, int value);
280 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
281 void (*setup_voice) (int dev, int voice, int chn);
282 int (*send_sysex)(int dev, unsigned char *bytes, int len);
284 struct voice_alloc_info alloc;
285 struct channel_info chn_info[16];
286 int emulation;
287 #define EMU_GM 1 /* General MIDI */
288 #define EMU_XG 2 /* Yamaha XG */
289 #define MAX_SYSEX_BUF 64
290 unsigned char sysex_buf[MAX_SYSEX_BUF];
291 int sysex_ptr;
294 struct midi_input_info
296 /* MIDI input scanner variables */
297 #define MI_MAX 10
298 volatile int m_busy;
299 unsigned char m_buf[MI_MAX];
300 unsigned char m_prev_status; /* For running status */
301 int m_ptr;
302 #define MST_INIT 0
303 #define MST_DATA 1
304 #define MST_SYSEX 2
305 int m_state;
306 int m_left;
309 struct midi_operations
311 struct module *owner;
312 struct midi_info info;
313 struct synth_operations *converter;
314 struct midi_input_info in_info;
315 int (*open) (int dev, int mode,
316 void (*inputintr)(int dev, unsigned char data),
317 void (*outputintr)(int dev)
319 void (*close) (int dev);
320 int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
321 int (*outputc) (int dev, unsigned char data);
322 int (*start_read) (int dev);
323 int (*end_read) (int dev);
324 void (*kick)(int dev);
325 int (*command) (int dev, unsigned char *data);
326 int (*buffer_status) (int dev);
327 int (*prefix_cmd) (int dev, unsigned char status);
328 struct coproc_operations *coproc;
329 void *devc;
332 struct sound_lowlev_timer
334 int dev;
335 int priority;
336 unsigned int (*tmr_start)(int dev, unsigned int usecs);
337 void (*tmr_disable)(int dev);
338 void (*tmr_restart)(int dev);
341 struct sound_timer_operations
343 struct module *owner;
344 struct sound_timer_info info;
345 int priority;
346 int devlink;
347 int (*open)(int dev, int mode);
348 void (*close)(int dev);
349 int (*event)(int dev, unsigned char *ev);
350 unsigned long (*get_time)(int dev);
351 int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
352 void (*arm_timer)(int dev, long time);
355 extern struct sound_timer_operations default_sound_timer;
357 extern struct audio_operations *audio_devs[MAX_AUDIO_DEV];
358 extern int num_audiodevs;
359 extern struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
360 extern int num_mixers;
361 extern struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
362 extern int num_synths;
363 extern struct midi_operations *midi_devs[MAX_MIDI_DEV];
364 extern int num_midis;
365 extern struct sound_timer_operations * sound_timer_devs[MAX_TIMER_DEV];
366 extern int num_sound_timers;
368 extern int sound_map_buffer (int dev, struct dma_buffparms *dmap, buffmem_desc *info);
369 void sound_timer_init (struct sound_lowlev_timer *t, char *name);
370 void sound_dma_intr (int dev, struct dma_buffparms *dmap, int chan);
372 #define AUDIO_DRIVER_VERSION 2
373 #define MIXER_DRIVER_VERSION 2
374 int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
375 int driver_size, int flags, unsigned int format_mask,
376 void *devc, int dma1, int dma2);
377 int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
378 int driver_size, void *devc);
380 void sound_unload_audiodev(int dev);
381 void sound_unload_mixerdev(int dev);
382 void sound_unload_mididev(int dev);
383 void sound_unload_synthdev(int dev);
384 void sound_unload_timerdev(int dev);
385 int sound_alloc_mixerdev(void);
386 int sound_alloc_timerdev(void);
387 int sound_alloc_synthdev(void);
388 int sound_alloc_mididev(void);
389 #endif /* _DEV_TABLE_H_ */