1 /*- 2 * Copyright (c) 1997,1998 Luigi Rizzo 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD: head/sys/dev/sound/isa/sb.h 166425 2007-02-02 13:33:35Z joel $ 27 */ 28 29 /* 30 * XXX swildner 31 * 32 * two PCI drivers, snd_solo(4) and snd_als4000(4), also need this file 33 */ 34 35 #ifndef SB_H 36 #define SB_H 37 38 struct sbc_softc; 39 void sbc_lock(struct sbc_softc *); 40 void sbc_lockassert(struct sbc_softc *); 41 void sbc_unlock(struct sbc_softc *); 42 43 /* 44 * sound blaster registers 45 */ 46 47 #define SBDSP_RST 0x6 48 #define DSP_READ 0xA 49 #define DSP_WRITE 0xC 50 #define SBDSP_CMD 0xC 51 #define SBDSP_STATUS 0xC 52 #define DSP_DATA_AVAIL 0xE 53 #define DSP_DATA_AVL16 0xF 54 55 #define SB_MIX_ADDR 0x4 56 #define SB_MIX_DATA 0x5 57 #if 0 58 #define OPL3_LEFT (io_base + 0x0) 59 #define OPL3_RIGHT (io_base + 0x2) 60 #define OPL3_BOTH (io_base + 0x8) 61 #endif 62 63 /* 64 * DSP Commands. There are many, and in many cases they are used explicitly 65 */ 66 67 /* these are not used except for programmed I/O (not in this driver) */ 68 #define DSP_DAC8 0x10 /* direct DAC output */ 69 #define DSP_ADC8 0x20 /* direct ADC input */ 70 71 /* these should be used in the SB 1.0 */ 72 #define DSP_CMD_DAC8 0x14 /* single cycle 8-bit dma out */ 73 #define DSP_CMD_ADC8 0x24 /* single cycle 8-bit dma in */ 74 75 /* these should be used in the SB 2.0 and 2.01 */ 76 #define DSP_CMD_DAC8_AUTO 0x1c /* auto 8-bit dma out */ 77 #define DSP_CMD_ADC8_AUTO 0x2c /* auto 8-bit dma out */ 78 79 #define DSP_CMD_HSSIZE 0x48 /* high speed dma count */ 80 #define DSP_CMD_HSDAC_AUTO 0x90 /* high speed dac, auto */ 81 #define DSP_CMD_HSADC_AUTO 0x98 /* high speed adc, auto */ 82 83 /* SBPro commands. Some cards (JAZZ, SMW) also support 16 bits */ 84 85 /* prepare for dma input */ 86 #define DSP_CMD_DMAMODE(stereo, bit16) (0xA0 | (stereo ? 8:0) | (bit16 ? 4:0)) 87 88 #define DSP_CMD_DAC2 0x16 /* 2-bit adpcm dma out (cont) */ 89 #define DSP_CMD_DAC2S 0x17 /* 2-bit adpcm dma out (start) */ 90 91 #define DSP_CMD_DAC2S_AUTO 0x1f /* auto 2-bit adpcm dma out (start) */ 92 93 94 /* SB16 commands */ 95 #define DSP_CMD_O16 0xb0 96 #define DSP_CMD_I16 0xb8 97 #define DSP_CMD_O8 0xc0 98 #define DSP_CMD_I8 0xc8 99 100 #define DSP_MODE_U8MONO 0x00 101 #define DSP_MODE_U8STEREO 0x20 102 #define DSP_MODE_S16MONO 0x10 103 #define DSP_MODE_S16STEREO 0x30 104 105 #define DSP_CMD_SPKON 0xD1 106 #define DSP_CMD_SPKOFF 0xD3 107 #define DSP_CMD_SPKR(on) (0xD1 | (on ? 0:2)) 108 109 #define DSP_CMD_DMAPAUSE_8 0xD0 110 #define DSP_CMD_DMAPAUSE_16 0xD5 111 #define DSP_CMD_DMAEXIT_8 0xDA 112 #define DSP_CMD_DMAEXIT_16 0xD9 113 #define DSP_CMD_TCONST 0x40 /* set time constant */ 114 #define DSP_CMD_HSDAC 0x91 /* high speed dac */ 115 #define DSP_CMD_HSADC 0x99 /* high speed adc */ 116 117 #define DSP_CMD_GETVER 0xE1 118 #define DSP_CMD_GETID 0xE7 /* return id bytes */ 119 120 121 #define DSP_CMD_OUT16 0x41 /* send parms for dma out on sb16 */ 122 #define DSP_CMD_IN16 0x42 /* send parms for dma in on sb16 */ 123 #if 0 /*** unknown ***/ 124 #define DSP_CMD_FA 0xFA /* get version from prosonic*/ 125 #define DSP_CMD_FB 0xFB /* set irq/dma for prosonic*/ 126 #endif 127 128 /* 129 * in fact, for the SB16, dma commands are as follows: 130 * 131 * cmd, mode, len_low, len_high. 132 * 133 * cmd is a combination of DSP_DMA16 or DSP_DMA8 and 134 */ 135 136 #define DSP_DMA16 0xb0 137 #define DSP_DMA8 0xc0 138 # define DSP_F16_DAC 0x00 139 # define DSP_F16_ADC 0x08 140 # define DSP_F16_AUTO 0x04 141 # define DSP_F16_FIFO_ON 0x02 142 143 /* 144 * mode is a combination of the following: 145 */ 146 #define DSP_F16_STEREO 0x20 147 #define DSP_F16_SIGNED 0x10 148 149 #define IMODE_NONE 0 150 #define IMODE_OUTPUT PCM_ENABLE_OUTPUT 151 #define IMODE_INPUT PCM_ENABLE_INPUT 152 #define IMODE_INIT 3 153 #define IMODE_MIDI 4 154 155 #define NORMAL_MIDI 0 156 #define UART_MIDI 1 157 158 /* 159 * values used for bd_flags in SoundBlaster driver 160 */ 161 #define BD_F_HISPEED 0x0001 /* doing high speed ... */ 162 163 #if 0 164 #define BD_F_JAZZ16 0x0002 /* jazz16 detected */ 165 #define BD_F_JAZZ16_2 0x0004 /* jazz16 type 2 */ 166 #endif 167 168 #define BD_F_DUP_MIDI 0x0008 /* duplex midi */ 169 170 #define BD_F_MIX_MASK 0x0070 /* up to 8 mixers (I know of 3) */ 171 #define BD_F_MIX_CT1335 0x0010 /* CT1335 */ 172 #define BD_F_MIX_CT1345 0x0020 /* CT1345 */ 173 #define BD_F_MIX_CT1745 0x0030 /* CT1745 */ 174 175 #define BD_F_SB16 0x0100 /* this is a SB16 */ 176 #define BD_F_SB16X 0x0200 /* this is a vibra16X or clone */ 177 #if 0 178 #define BD_F_MIDIBUSY 0x0400 /* midi busy */ 179 #endif 180 #define BD_F_ESS 0x0800 /* this is an ESS chip */ 181 #define BD_F_DMARUN 0x2000 182 #define BD_F_DMARUN2 0x4000 183 184 /* 185 * Mixer registers of SB Pro 186 */ 187 #define VOC_VOL 0x04 188 #define MIC_VOL 0x0A 189 #define MIC_MIX 0x0A 190 #define RECORD_SRC 0x0C 191 #define IN_FILTER 0x0C 192 #define OUT_FILTER 0x0E 193 #define MASTER_VOL 0x22 194 #define FM_VOL 0x26 195 #define CD_VOL 0x28 196 #define LINE_VOL 0x2E 197 #define IRQ_NR 0x80 198 #define DMA_NR 0x81 199 #define IRQ_STAT 0x82 200 201 /* 202 * Additional registers on the SG NX Pro 203 */ 204 #define COVOX_VOL 0x42 205 #define TREBLE_LVL 0x44 206 #define BASS_LVL 0x46 207 208 #define FREQ_HI (1 << 3)/* Use High-frequency ANFI filters */ 209 #define FREQ_LOW 0 /* Use Low-frequency ANFI filters */ 210 #define FILT_ON 0 /* Yes, 0 to turn it on, 1 for off */ 211 #define FILT_OFF (1 << 5) 212 213 #define MONO_DAC 0x00 214 #define STEREO_DAC 0x02 215 216 /* 217 * Mixer registers of SB16 218 */ 219 #define SB16_IMASK_L 0x3d 220 #define SB16_IMASK_R 0x3e 221 #define SB16_OMASK 0x3c 222 #endif 223