1 /* sound_config.h 2 * 3 * A driver for Soundcards, misc configuration parameters. 4 * 5 * 6 * Copyright by Hannu Savolainen 1995 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 */ 30 31 #undef CONFIGURE_SOUNDCARD 32 #undef DYNAMIC_BUFFER 33 34 #include "local.h" 35 36 #ifdef KERNEL_SOUNDCARD 37 #define CONFIGURE_SOUNDCARD 38 #define DYNAMIC_BUFFER 39 #undef LOADABLE_SOUNDCARD 40 #endif 41 42 #include "os.h" 43 #include "soundvers.h" 44 45 #if defined(ISC) || defined(SCO) || defined(SVR42) 46 #define GENERIC_SYSV 47 #endif 48 49 50 51 52 53 54 55 #ifndef SND_DEFAULT_ENABLE 56 #define SND_DEFAULT_ENABLE 1 57 #endif 58 59 #ifdef CONFIGURE_SOUNDCARD 60 61 #ifndef MAX_REALTIME_FACTOR 62 #define MAX_REALTIME_FACTOR 4 63 #endif 64 65 /************* PCM DMA buffer sizes *******************/ 66 67 /* If you are using high playback or recording speeds, the default buffersize 68 is too small. DSP_BUFFSIZE must be 64k or less. 69 70 A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and 71 4k for SB. 72 73 If you change the DSP_BUFFSIZE, don't modify this file. 74 Use the make config command instead. */ 75 76 #ifndef DSP_BUFFSIZE 77 #define DSP_BUFFSIZE (4096) 78 #endif 79 80 #ifndef DSP_BUFFCOUNT 81 #define DSP_BUFFCOUNT 1 /* 1 is recommended. */ 82 #endif 83 84 #define DMA_AUTOINIT 0x10 85 86 #define FM_MONO 0x388 /* This is the I/O address used by AdLib */ 87 88 #ifndef PAS_BASE 89 #define PAS_BASE 0x388 90 #endif 91 92 #ifdef JAZZ16 93 #ifndef JAZZ_DMA16 94 #define JAZZ_DMA16 5 95 #endif 96 #endif 97 98 /* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the 99 driver. (There is no need to alter this) */ 100 #define SEQ_MAX_QUEUE 1024 101 102 #define SBFM_MAXINSTR (256) /* Size of the FM Instrument bank */ 103 /* 128 instruments for general MIDI setup and 16 unassigned */ 104 105 /* 106 * Minor numbers for the sound driver. 107 * 108 * Unfortunately Creative called the codec chip of SB as a DSP. For this 109 * reason the /dev/dsp is reserved for digitized audio use. There is a 110 * device for true DSP processors but it will be called something else. 111 * In v3.0 it's /dev/sndproc but this could be a temporary solution. 112 */ 113 114 #define SND_NDEVS 256 /* Number of supported devices */ 115 #define SND_DEV_CTL 0 /* Control port /dev/mixer */ 116 #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM 117 synthesizer and MIDI output) */ 118 #define SND_DEV_MIDIN 2 /* Raw midi access */ 119 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ 120 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ 121 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ 122 #define SND_DEV_STATUS 6 /* /dev/sndstat */ 123 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */ 124 #define SND_DEV_SEQ2 8 /* /dev/sequecer, level 2 interface */ 125 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ 126 #define SND_DEV_PSS SND_DEV_SNDPROC 127 128 #define DSP_DEFAULT_SPEED 8000 129 130 #define ON 1 131 #define OFF 0 132 133 #define MAX_AUDIO_DEV 5 134 #define MAX_MIXER_DEV 5 135 #define MAX_SYNTH_DEV 3 136 #define MAX_MIDI_DEV 6 137 #define MAX_TIMER_DEV 3 138 139 struct fileinfo { 140 int mode; /* Open mode */ 141 int flags; 142 int dummy; /* Reference to file-flags. OS-dependent. */ 143 }; 144 145 struct address_info { 146 int io_base; 147 int irq; 148 int dma; 149 int dma2; 150 int always_detect; /* 1=Trust me, it's there */ 151 char *name; 152 int driver_use_1; /* Driver defined field 1 */ 153 int driver_use_2; /* Driver defined field 2 */ 154 sound_os_info *osp; /* OS spesific info */ 155 int card_subtype; /* Driver spesific. Usually 0 */ 156 }; 157 158 #define SYNTH_MAX_VOICES 32 159 160 struct voice_alloc_info { 161 int max_voice; 162 int used_voices; 163 int ptr; /* For device specific use */ 164 unsigned short map[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */ 165 int timestamp; 166 int alloc_times[SYNTH_MAX_VOICES]; 167 }; 168 169 struct channel_info { 170 int pgm_num; 171 int bender_value; 172 unsigned char controllers[128]; 173 }; 174 175 /* 176 * Process wakeup reasons 177 */ 178 #define WK_NONE 0x00 179 #define WK_WAKEUP 0x01 180 #define WK_TIMEOUT 0x02 181 #define WK_SIGNAL 0x04 182 #define WK_SLEEP 0x08 183 184 #define OPEN_READ PCM_ENABLE_INPUT 185 #define OPEN_WRITE PCM_ENABLE_OUTPUT 186 #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) 187 188 #include "sound_calls.h" 189 #include "dev_table.h" 190 191 #ifndef DEB 192 #define DEB(x) 193 #endif 194 195 #ifndef DDB 196 #define DDB(x) 197 #endif 198 199 #define TIMER_ARMED 121234 200 #define TIMER_NOT_ARMED 1 201 202 #endif