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
19 * Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
20 * Numbers 1000 to N are reserved for driver's internal use.
23 #define SNDCARD_DESKPROXL 27 /* Compaq Deskpro XL */
24 #define SNDCARD_VIDC 28 /* ARMs VIDC */
25 #define SNDCARD_SBPNP 29
26 #define SNDCARD_SOFTOSS 36
27 #define SNDCARD_VMIDI 37
28 #define SNDCARD_OPL3SA1 38 /* Note: clash in msnd.h */
29 #define SNDCARD_OPL3SA1_SB 39
30 #define SNDCARD_OPL3SA1_MPU 40
31 #define SNDCARD_WAVEFRONT 41
32 #define SNDCARD_OPL3SA2 42
33 #define SNDCARD_OPL3SA2_MPU 43
34 #define SNDCARD_WAVEARTIST 44 /* Waveartist */
35 #define SNDCARD_OPL3SA2_MSS 45 /* Originally missed */
36 #define SNDCARD_AD1816 88
39 * NOTE! NOTE! NOTE! NOTE!
41 * If you modify this file, please check the dev_table.c also.
43 * NOTE! NOTE! NOTE! NOTE!
49 int card_subtype; /* Driver specific. Usually 0 */
50 int card_type; /* From soundcard.h */
52 void (*attach) (struct address_info *hw_config);
53 int (*probe) (struct address_info *hw_config);
54 void (*unload) (struct address_info *hw_config);
59 int card_type; /* Link (search key) to the driver list */
60 struct address_info config;
67 * Device specific parameters (used only by dmabuf.c)
69 #define MAX_SUB_BUFFERS (32*MAX_REALTIME_FACTOR)
72 #define DMODE_OUTPUT PCM_ENABLE_OUTPUT
73 #define DMODE_INPUT PCM_ENABLE_INPUT
77 int dma_mode; /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
81 * Pointers to raw buffers
85 unsigned long raw_buf_phys;
93 #define DMA_BUSY 0x00000001
94 #define DMA_RESTART 0x00000002
95 #define DMA_ACTIVE 0x00000004
96 #define DMA_STARTED 0x00000008
97 #define DMA_EMPTY 0x00000010
98 #define DMA_ALLOC_DONE 0x00000020
99 #define DMA_SYNCING 0x00000040
100 #define DMA_DIRTY 0x00000080
101 #define DMA_POST 0x00000100
102 #define DMA_NODMA 0x00000200
103 #define DMA_NOTIMEOUT 0x00000400
113 int cfrag; /* Current incomplete fragment (write) */
116 int counts[MAX_SUB_BUFFERS];
126 unsigned long byte_counter;
127 unsigned long user_counter;
128 unsigned long max_byte_counter;
129 int data_rate; /* Bytes/second */
132 #define DMA_MAP_MAPPED 0x00000001
134 int dma; /* DMA channel */
136 int applic_profile; /* Application profile (APF_*) */
137 /* Interrupt callback stuff */
138 void (*audio_callback) (int dev, int parm);
141 int buf_flags[MAX_SUB_BUFFERS];
142 #define BUFF_EOF 0x00000001 /* Increment eof count */
143 #define BUFF_DIRTY 0x00000002 /* Buffer written */
147 * Structure for use with various microcontrollers and DSP processors
148 * in the recent sound cards.
150 typedef struct coproc_operations
153 struct module *owner;
154 int (*open) (void *devc, int sub_device);
155 void (*close) (void *devc, int sub_device);
156 int (*ioctl) (void *devc, unsigned int cmd, caddr_t arg, int local);
157 void (*reset) (void *devc);
159 void *devc; /* Driver specific info */
164 struct module *owner;
165 int (*open) (int dev, int mode);
166 void (*close) (int dev);
167 void (*output_block) (int dev, unsigned long buf,
168 int count, int intrflag);
169 void (*start_input) (int dev, unsigned long buf,
170 int count, int intrflag);
171 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
172 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
173 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
174 void (*halt_io) (int dev);
175 int (*local_qlen)(int dev);
176 void (*copy_user) (int dev,
177 char *localbuf, int localoffs,
178 const char *userbuf, int useroffs,
179 int max_in, int max_out,
180 int *used, int *returned,
182 void (*halt_input) (int dev);
183 void (*halt_output) (int dev);
184 void (*trigger) (int dev, int bits);
185 int (*set_speed)(int dev, int speed);
186 unsigned int (*set_bits)(int dev, unsigned int bits);
187 short (*set_channels)(int dev, short channels);
188 void (*postprocess_write)(int dev); /* Device spesific postprocessing for written data */
189 void (*preprocess_read)(int dev); /* Device spesific preprocessing for read data */
190 void (*mmap)(int dev);
193 struct audio_operations
197 #define NOTHING_SPECIAL 0x00
198 #define NEEDS_RESTART 0x01
199 #define DMA_AUTOMODE 0x02
200 #define DMA_DUPLEX 0x04
201 #define DMA_PSEUDO_AUTOMODE 0x08
202 #define DMA_HARDSTOP 0x10
203 #define DMA_EXACT 0x40
204 #define DMA_NORESET 0x80
205 int format_mask; /* Bitmask for supported audio formats */
206 void *devc; /* Driver specific info */
207 struct audio_driver *d;
208 void *portc; /* Driver spesific info */
209 struct dma_buffparms *dmap_in, *dmap_out;
210 struct coproc_operations *coproc;
215 int min_fragment; /* 0 == unlimited */
216 int max_fragment; /* 0 == unlimited */
217 int parent_dev; /* 0 -> no parent, 1 to n -> parent=parent_dev+1 */
219 /* fields formerly in dmabuf.c */
220 wait_queue_head_t in_sleeper;
221 wait_queue_head_t out_sleeper;
222 wait_queue_head_t poll_sleeper;
224 /* fields formerly in audio.c */
228 #define AM_WRITE OPEN_WRITE
229 #define AM_READ OPEN_READ
233 int local_conversion;
234 #define CNV_MU_LAW 0x00000001
236 /* large structures at the end to keep offsets small */
237 struct dma_buffparms dmaps[2];
240 int *load_mixer_volumes(char *name, int *levels, int present);
242 struct mixer_operations
244 struct module *owner;
247 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
253 struct synth_operations
255 struct module *owner;
256 char *id; /* Unique identifier (ASCII) max 29 char */
257 struct synth_info *info;
262 int (*open) (int dev, int mode);
263 void (*close) (int dev);
264 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
265 int (*kill_note) (int dev, int voice, int note, int velocity);
266 int (*start_note) (int dev, int voice, int note, int velocity);
267 int (*set_instr) (int dev, int voice, int instr);
268 void (*reset) (int dev);
269 void (*hw_control) (int dev, unsigned char *event);
270 int (*load_patch) (int dev, int format, const char *addr,
271 int offs, int count, int pmgr_flag);
272 void (*aftertouch) (int dev, int voice, int pressure);
273 void (*controller) (int dev, int voice, int ctrl_num, int value);
274 void (*panning) (int dev, int voice, int value);
275 void (*volume_method) (int dev, int mode);
276 void (*bender) (int dev, int chn, int value);
277 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
278 void (*setup_voice) (int dev, int voice, int chn);
279 int (*send_sysex)(int dev, unsigned char *bytes, int len);
281 struct voice_alloc_info alloc;
282 struct channel_info chn_info[16];
284 #define EMU_GM 1 /* General MIDI */
285 #define EMU_XG 2 /* Yamaha XG */
286 #define MAX_SYSEX_BUF 64
287 unsigned char sysex_buf[MAX_SYSEX_BUF];
291 struct midi_input_info
293 /* MIDI input scanner variables */
296 unsigned char m_buf[MI_MAX];
297 unsigned char m_prev_status; /* For running status */
306 struct midi_operations
308 struct module *owner;
309 struct midi_info info;
310 struct synth_operations *converter;
311 struct midi_input_info in_info;
312 int (*open) (int dev, int mode,
313 void (*inputintr)(int dev, unsigned char data),
314 void (*outputintr)(int dev)
316 void (*close) (int dev);
317 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
318 int (*outputc) (int dev, unsigned char data);
319 int (*start_read) (int dev);
320 int (*end_read) (int dev);
321 void (*kick)(int dev);
322 int (*command) (int dev, unsigned char *data);
323 int (*buffer_status) (int dev);
324 int (*prefix_cmd) (int dev, unsigned char status);
325 struct coproc_operations *coproc;
329 struct sound_lowlev_timer
333 unsigned int (*tmr_start)(int dev, unsigned int usecs);
334 void (*tmr_disable)(int dev);
335 void (*tmr_restart)(int dev);
338 struct sound_timer_operations
340 struct module *owner;
341 struct sound_timer_info info;
344 int (*open)(int dev, int mode);
345 void (*close)(int dev);
346 int (*event)(int dev, unsigned char *ev);
347 unsigned long (*get_time)(int dev);
348 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
349 void (*arm_timer)(int dev, long time);
353 struct audio_operations *audio_devs[MAX_AUDIO_DEV];
355 struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
357 struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
359 struct midi_operations *midi_devs[MAX_MIDI_DEV];
362 extern struct sound_timer_operations default_sound_timer;
363 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {
364 &default_sound_timer, NULL
366 int num_sound_timers = 1;
368 extern struct audio_operations *audio_devs[MAX_AUDIO_DEV];
369 extern int num_audiodevs;
370 extern struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
371 extern int num_mixers;
372 extern struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
373 extern int num_synths;
374 extern struct midi_operations *midi_devs[MAX_MIDI_DEV];
375 extern int num_midis;
376 extern struct sound_timer_operations * sound_timer_devs[MAX_TIMER_DEV];
377 extern int num_sound_timers;
378 #endif /* _DEV_TABLE_C_ */
380 extern int sound_map_buffer (int dev, struct dma_buffparms *dmap, buffmem_desc *info);
381 void sound_timer_init (struct sound_lowlev_timer *t, char *name);
382 void sound_dma_intr (int dev, struct dma_buffparms *dmap, int chan);
384 #define AUDIO_DRIVER_VERSION 2
385 #define MIXER_DRIVER_VERSION 2
386 int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
387 int driver_size, int flags, unsigned int format_mask,
388 void *devc, int dma1, int dma2);
389 int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
390 int driver_size, void *devc);
392 void sound_unload_audiodev(int dev);
393 void sound_unload_mixerdev(int dev);
394 void sound_unload_mididev(int dev);
395 void sound_unload_synthdev(int dev);
396 void sound_unload_timerdev(int dev);
397 int sound_alloc_audiodev(void);
398 int sound_alloc_mixerdev(void);
399 int sound_alloc_timerdev(void);
400 int sound_alloc_synthdev(void);
401 int sound_alloc_mididev(void);
402 #endif /* _DEV_TABLE_H_ */