Import 2.1.122pre3
[davej-history.git] / drivers / sound / sb.h
blobf3d99cff41b5d1f4e381f5193d227196c82a99ac
1 #include <linux/config.h>
2 #include "legacy.h"
4 #ifdef CONFIG_SBDSP
5 #define DSP_RESET (devc->base + 0x6)
6 #define DSP_READ (devc->base + 0xA)
7 #define DSP_WRITE (devc->base + 0xC)
8 #define DSP_COMMAND (devc->base + 0xC)
9 #define DSP_STATUS (devc->base + 0xC)
10 #define DSP_DATA_AVAIL (devc->base + 0xE)
11 #define DSP_DATA_AVL16 (devc->base + 0xF)
12 #define MIXER_ADDR (devc->base + 0x4)
13 #define MIXER_DATA (devc->base + 0x5)
14 #define OPL3_LEFT (devc->base + 0x0)
15 #define OPL3_RIGHT (devc->base + 0x2)
16 #define OPL3_BOTH (devc->base + 0x8)
17 /* DSP Commands */
19 #define DSP_CMD_SPKON 0xD1
20 #define DSP_CMD_SPKOFF 0xD3
21 #define DSP_CMD_DMAON 0xD0
22 #define DSP_CMD_DMAOFF 0xD4
24 #define IMODE_NONE 0
25 #define IMODE_OUTPUT PCM_ENABLE_OUTPUT
26 #define IMODE_INPUT PCM_ENABLE_INPUT
27 #define IMODE_INIT 3
28 #define IMODE_MIDI 4
30 #define NORMAL_MIDI 0
31 #define UART_MIDI 1
35 * Device models
37 #define MDL_NONE 0
38 #define MDL_SB1 1 /* SB1.0 or 1.5 */
39 #define MDL_SB2 2 /* SB2.0 */
40 #define MDL_SB201 3 /* SB2.01 */
41 #define MDL_SBPRO 4 /* SB Pro */
42 #define MDL_SB16 5 /* SB16/32/AWE */
43 #define MDL_SBPNP 6 /* SB16/32/AWE PnP */
44 #define MDL_JAZZ 10 /* Media Vision Jazz16 */
45 #define MDL_SMW 11 /* Logitech SoundMan Wave (Jazz16) */
46 #define MDL_ESS 12 /* ESS ES688 and ES1688 */
47 #define MDL_AZTECH 13 /* Aztech Sound Galaxy family */
48 #define MDL_ES1868MIDI 14 /* MIDI port of ESS1868 */
49 #define MDL_AEDSP 15 /* Audio Excel DSP 16 */
51 #define SUBMDL_ALS007 42 /* ALS-007 differs from SB16 only in mixer */
52 /* register assignment */
54 * Config flags
56 #define SB_NO_MIDI 0x00000001
57 #define SB_NO_MIXER 0x00000002
58 #define SB_NO_AUDIO 0x00000004
59 #define SB_NO_RECORDING 0x00000008 /* No audio recording */
60 #define SB_MIDI_ONLY (SB_NO_AUDIO|SB_NO_MIXER)
62 struct mixer_def {
63 unsigned int regno: 8;
64 unsigned int bitoffs:4;
65 unsigned int nbits:4;
68 typedef struct mixer_def mixer_tab[32][2];
69 typedef struct mixer_def mixer_ent;
71 typedef struct sb_devc {
72 int dev;
74 /* Hardware parameters */
75 int *osp;
76 int minor, major;
77 int type;
78 int model, submodel;
79 int caps;
80 # define SBCAP_STEREO 0x00000001
81 # define SBCAP_16BITS 0x00000002
83 /* Hardware resources */
84 int base;
85 int irq;
86 int dma8, dma16;
88 /* State variables */
89 int opened;
90 int speed, bits, channels;
91 volatile int irq_ok;
92 volatile int intr_active, irq_mode;
94 /* Mixer fields */
95 int *levels;
96 mixer_tab *iomap;
97 int mixer_caps, recmask, supported_devices;
98 int supported_rec_devices;
99 int my_mixerdev;
100 int sbmixnum;
102 /* Audio fields */
103 unsigned long trg_buf;
104 int trigger_bits;
105 int trg_bytes;
106 int trg_intrflag;
107 int trg_restart;
108 unsigned char tconst;
109 int my_dev;
111 /* MIDI fields */
112 int my_mididev;
113 int input_opened;
114 int midi_broken;
115 void (*midi_input_intr) (int dev, unsigned char data);
116 void *midi_irq_cookie; /* IRQ cookie for the midi */
117 } sb_devc;
119 int sb_dsp_command (sb_devc *devc, unsigned char val);
120 int sb_dsp_reset (sb_devc *devc);
121 void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value);
122 unsigned int sb_getmixer (sb_devc *devc, unsigned int port);
123 int sb_dsp_detect (struct address_info *hw_config);
124 int sb_dsp_init (struct address_info *hw_config);
125 void sb_dsp_unload(struct address_info *hw_config, int sbmpu);
126 int sb_mixer_init(sb_devc *devc);
127 void sb_mixer_set_stereo (sb_devc *devc, int mode);
128 void smw_mixer_init(sb_devc *devc);
129 void sb_dsp_midi_init (sb_devc *devc);
130 void sb_audio_init (sb_devc *devc, char *name);
131 void sb_midi_interrupt (sb_devc *devc);
132 int ess_write (sb_devc *devc, unsigned char reg, unsigned char data);
133 int ess_read (sb_devc *devc, unsigned char reg);
135 extern int acer;
136 extern sb_devc *last_sb;
137 #endif