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 #include "os.h" 32 #include "local.h" 33 #include "soundvers.h" 34 35 #if defined(ISC) || defined(SCO) || defined(SVR42) 36 #define GENERIC_SYSV 37 #endif 38 39 40 41 42 43 44 #ifndef SND_DEFAULT_ENABLE 45 #define SND_DEFAULT_ENABLE 1 46 #endif 47 48 #ifndef MAX_REALTIME_FACTOR 49 #define MAX_REALTIME_FACTOR 4 50 #endif 51 52 /************* PCM DMA buffer sizes *******************/ 53 54 /* If you are using high playback or recording speeds, the default buffersize 55 is too small. DSP_BUFFSIZE must be 64k or less. 56 57 A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and 58 4k for SB. 59 60 If you change the DSP_BUFFSIZE, don't modify this file. 61 Use the make config command instead. */ 62 63 #ifndef DSP_BUFFSIZE 64 #define DSP_BUFFSIZE (4096) 65 #endif 66 67 #ifndef DSP_BUFFCOUNT 68 #define DSP_BUFFCOUNT 1 /* 1 is recommended. */ 69 #endif 70 71 #define DMA_AUTOINIT 0x10 72 73 #define FM_MONO 0x388 /* This is the I/O address used by AdLib */ 74 75 #ifndef PAS_BASE 76 #define PAS_BASE 0x388 77 #endif 78 79 #if defined(SB16_DMA) && !defined(SB_DMA2) 80 # define SB_DMA2 SB16_DMA 81 #endif 82 83 #if defined(SB16MIDI_BASE) && !defined(SB_MPU_BASE) 84 # define SB_MPU_BASE SB16MIDI_BASE 85 #endif 86 87 #ifndef SB_MPU_IRQ 88 # define SB_MPU_IRQ SBC_IRQ 89 #endif 90 91 /* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the 92 driver. (There is no need to alter this) */ 93 #define SEQ_MAX_QUEUE 1024 94 95 #define SBFM_MAXINSTR (256) /* Size of the FM Instrument bank */ 96 /* 128 instruments for general MIDI setup and 16 unassigned */ 97 98 /* 99 * Minor numbers for the sound driver. 100 * 101 * Unfortunately Creative called the codec chip of SB as a DSP. For this 102 * reason the /dev/dsp is reserved for digitized audio use. There is a 103 * device for true DSP processors but it will be called something else. 104 * In v3.0 it's /dev/sndproc but this could be a temporary solution. 105 */ 106 107 #define SND_NDEVS 256 /* Number of supported devices */ 108 #define SND_DEV_CTL 0 /* Control port /dev/mixer */ 109 #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM 110 synthesizer and MIDI output) */ 111 #define SND_DEV_MIDIN 2 /* Raw midi access */ 112 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ 113 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ 114 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ 115 #define SND_DEV_STATUS 6 /* /dev/sndstat */ 116 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */ 117 #define SND_DEV_SEQ2 8 /* /dev/sequecer, level 2 interface */ 118 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ 119 #define SND_DEV_PSS SND_DEV_SNDPROC 120 121 #define DSP_DEFAULT_SPEED 8000 122 123 #define ON 1 124 #define OFF 0 125 126 #define MAX_AUDIO_DEV 5 127 #define MAX_MIXER_DEV 5 128 #define MAX_SYNTH_DEV 3 129 #define MAX_MIDI_DEV 6 130 #define MAX_TIMER_DEV 3 131 132 struct fileinfo { 133 int mode; /* Open mode */ 134 int flags; 135 int dummy; /* Reference to file-flags. OS-dependent. */ 136 }; 137 138 struct address_info { 139 int io_base; 140 int irq; 141 int dma; 142 int dma2; 143 int always_detect; /* 1=Trust me, it's there */ 144 char *name; 145 int driver_use_1; /* Driver defined field 1 */ 146 int driver_use_2; /* Driver defined field 2 */ 147 sound_os_info *osp; /* OS spesific info */ 148 int card_subtype; /* Driver spesific. Usually 0 */ 149 }; 150 151 #define SYNTH_MAX_VOICES 32 152 153 struct voice_alloc_info { 154 int max_voice; 155 int used_voices; 156 int ptr; /* For device specific use */ 157 unsigned short map[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */ 158 int timestamp; 159 int alloc_times[SYNTH_MAX_VOICES]; 160 }; 161 162 struct channel_info { 163 int pgm_num; 164 int bender_value; 165 unsigned char controllers[128]; 166 }; 167 168 /* 169 * Process wakeup reasons 170 */ 171 #define WK_NONE 0x00 172 #define WK_WAKEUP 0x01 173 #define WK_TIMEOUT 0x02 174 #define WK_SIGNAL 0x04 175 #define WK_SLEEP 0x08 176 177 #define OPEN_READ PCM_ENABLE_INPUT 178 #define OPEN_WRITE PCM_ENABLE_OUTPUT 179 #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) 180 181 #include "sound_calls.h" 182 #include "dev_table.h" 183 184 #ifndef DEB 185 #define DEB(x) 186 #endif 187 188 #ifndef DDB 189 #define DDB(x) 190 #endif 191 192 #define TIMER_ARMED 121234 193 #define TIMER_NOT_ARMED 1