1 #define DSP_RESET (devc->base + 0x6) 2 #define DSP_READ (devc->base + 0xA) 3 #define DSP_WRITE (devc->base + 0xC) 4 #define DSP_COMMAND (devc->base + 0xC) 5 #define DSP_STATUS (devc->base + 0xC) 6 #define DSP_DATA_AVAIL (devc->base + 0xE) 7 #define DSP_DATA_AVL16 (devc->base + 0xF) 8 #define MIXER_ADDR (devc->base + 0x4) 9 #define MIXER_DATA (devc->base + 0x5) 10 #define OPL3_LEFT (devc->base + 0x0) 11 #define OPL3_RIGHT (devc->base + 0x2) 12 #define OPL3_BOTH (devc->base + 0x8) 13 /* DSP Commands */ 14 15 #define DSP_CMD_SPKON 0xD1 16 #define DSP_CMD_SPKOFF 0xD3 17 #define DSP_CMD_DMAON 0xD0 18 #define DSP_CMD_DMAOFF 0xD4 19 20 #define IMODE_NONE 0 21 #define IMODE_OUTPUT PCM_ENABLE_OUTPUT 22 #define IMODE_INPUT PCM_ENABLE_INPUT 23 #define IMODE_INIT 3 24 #define IMODE_MIDI 4 25 26 #define NORMAL_MIDI 0 27 #define UART_MIDI 1 28 29 30 /* 31 * Device models 32 */ 33 #define MDL_NONE 0 34 #define MDL_SB1 1 /* SB1.0 or 1.5 */ 35 #define MDL_SB2 2 /* SB2.0 */ 36 #define MDL_SB201 3 /* SB2.01 */ 37 #define MDL_SBPRO 4 /* SB Pro */ 38 #define MDL_SB16 5 /* SB16/32/AWE */ 39 #define MDL_SBPNP 6 /* SB16/32/AWE PnP */ 40 #define MDL_JAZZ 10 /* Media Vision Jazz16 */ 41 #define MDL_SMW 11 /* Logitech SoundMan Wave (Jazz16) */ 42 #define MDL_ESS 12 /* ESS ES688 and ES1688 */ 43 #define MDL_AZTECH 13 /* Aztech Sound Galaxy family */ 44 #define MDL_ES1868MIDI 14 /* MIDI port of ESS1868 */ 45 #define MDL_AEDSP 15 /* Audio Excel DSP 16 */ 46 #define MDL_ESSPCI 16 /* ESS PCI card */ 47 #define MDL_YMPCI 17 /* Yamaha PCI sb in emulation */ 48 49 #define SUBMDL_ALS007 42 /* ALS-007 differs from SB16 only in mixer */ 50 /* register assignment */ 51 #define SUBMDL_ALS100 43 /* ALS-100 allows sampling rates of up */ 52 /* to 48kHz */ 53 54 /* 55 * Config flags 56 */ 57 #define SB_NO_MIDI 0x00000001 58 #define SB_NO_MIXER 0x00000002 59 #define SB_NO_AUDIO 0x00000004 60 #define SB_NO_RECORDING 0x00000008 /* No audio recording */ 61 #define SB_MIDI_ONLY (SB_NO_AUDIO|SB_NO_MIXER) 62 #define SB_PCI_IRQ 0x00000010 /* PCI shared IRQ */ 63 64 struct mixer_def { 65 unsigned int regno: 8; 66 unsigned int bitoffs:4; 67 unsigned int nbits:4; 68 }; 69 70 typedef struct mixer_def mixer_tab[32][2]; 71 typedef struct mixer_def mixer_ent; 72 73 struct sb_module_options 74 { 75 int esstype; /* ESS chip type */ 76 int acer; /* Do acer notebook init? */ 77 int sm_games; /* Logitech soundman games? */ 78 }; 79 80 typedef struct sb_devc { 81 int dev; 82 83 /* Hardware parameters */ 84 int *osp; 85 int minor, major; 86 int type; 87 int model, submodel; 88 int caps; 89 # define SBCAP_STEREO 0x00000001 90 # define SBCAP_16BITS 0x00000002 91 92 /* Hardware resources */ 93 int base; 94 int irq; 95 int dma8, dma16; 96 97 int pcibase; /* For ESS Maestro etc */ 98 99 /* State variables */ 100 int opened; 101 /* new audio fields for full duplex support */ 102 int fullduplex; 103 int duplex; 104 int speed, bits, channels; 105 volatile int irq_ok; 106 volatile int intr_active, irq_mode; 107 /* duplicate audio fields for full duplex support */ 108 volatile int intr_active_16, irq_mode_16; 109 110 /* Mixer fields */ 111 int *levels; 112 mixer_tab *iomap; 113 int mixer_caps, recmask, outmask, supported_devices; 114 int supported_rec_devices, supported_out_devices; 115 int my_mixerdev; 116 int sbmixnum; 117 118 /* Audio fields */ 119 unsigned long trg_buf; 120 int trigger_bits; 121 int trg_bytes; 122 int trg_intrflag; 123 int trg_restart; 124 /* duplicate audio fields for full duplex support */ 125 unsigned long trg_buf_16; 126 int trigger_bits_16; 127 int trg_bytes_16; 128 int trg_intrflag_16; 129 int trg_restart_16; 130 131 unsigned char tconst; 132 133 /* MIDI fields */ 134 int my_mididev; 135 int input_opened; 136 int midi_broken; 137 void (*midi_input_intr) (int dev, unsigned char data); 138 void *midi_irq_cookie; /* IRQ cookie for the midi */ 139 140 spinlock_t lock; 141 142 struct sb_module_options sbmo; /* Module options */ 143 144 } sb_devc; 145 146 /* 147 * PCI card types 148 */ 149 150 #define SB_PCI_ESSMAESTRO 1 /* ESS Maestro Legacy */ 151 #define SB_PCI_YAMAHA 2 /* Yamaha Legacy */ 152 153 /* 154 * Functions 155 */ 156 157 int sb_dsp_command (sb_devc *devc, unsigned char val); 158 int sb_dsp_get_byte(sb_devc * devc); 159 int sb_dsp_reset (sb_devc *devc); 160 void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value); 161 unsigned int sb_getmixer (sb_devc *devc, unsigned int port); 162 int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo); 163 int sb_dsp_init (struct address_info *hw_config, struct module *owner); 164 void sb_dsp_unload(struct address_info *hw_config, int sbmpu); 165 int sb_mixer_init(sb_devc *devc, struct module *owner); 166 void sb_mixer_unload(sb_devc *devc); 167 void sb_mixer_set_stereo (sb_devc *devc, int mode); 168 void smw_mixer_init(sb_devc *devc); 169 void sb_dsp_midi_init (sb_devc *devc, struct module *owner); 170 void sb_audio_init (sb_devc *devc, char *name, struct module *owner); 171 void sb_midi_interrupt (sb_devc *devc); 172 void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val); 173 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right); 174 175 int sb_audio_open(int dev, int mode); 176 void sb_audio_close(int dev); 177 178 extern sb_devc *last_sb; 179 180 /* From sb_common.c */ 181 void sb_dsp_disable_midi(int port); 182 void sb_dsp_disable_recording(int port); 183 int probe_sbmpu (struct address_info *hw_config, struct module *owner); 184 void unload_sbmpu (struct address_info *hw_config); 185 186 void unload_sb16(struct address_info *hw_info); 187 void unload_sb16midi(struct address_info *hw_info); 188