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 size_t iomap_sz; /* number or records in the iomap table */ 114 int mixer_caps, recmask, outmask, supported_devices; 115 int supported_rec_devices, supported_out_devices; 116 int my_mixerdev; 117 int sbmixnum; 118 119 /* Audio fields */ 120 unsigned long trg_buf; 121 int trigger_bits; 122 int trg_bytes; 123 int trg_intrflag; 124 int trg_restart; 125 /* duplicate audio fields for full duplex support */ 126 unsigned long trg_buf_16; 127 int trigger_bits_16; 128 int trg_bytes_16; 129 int trg_intrflag_16; 130 int trg_restart_16; 131 132 unsigned char tconst; 133 134 /* MIDI fields */ 135 int my_mididev; 136 int input_opened; 137 int midi_broken; 138 void (*midi_input_intr) (int dev, unsigned char data); 139 void *midi_irq_cookie; /* IRQ cookie for the midi */ 140 141 spinlock_t lock; 142 143 struct sb_module_options sbmo; /* Module options */ 144 145 } sb_devc; 146 147 /* 148 * PCI card types 149 */ 150 151 #define SB_PCI_ESSMAESTRO 1 /* ESS Maestro Legacy */ 152 #define SB_PCI_YAMAHA 2 /* Yamaha Legacy */ 153 154 /* 155 * Functions 156 */ 157 158 int sb_dsp_command (sb_devc *devc, unsigned char val); 159 int sb_dsp_get_byte(sb_devc * devc); 160 int sb_dsp_reset (sb_devc *devc); 161 void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value); 162 unsigned int sb_getmixer (sb_devc *devc, unsigned int port); 163 int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo); 164 int sb_dsp_init (struct address_info *hw_config, struct module *owner); 165 void sb_dsp_unload(struct address_info *hw_config, int sbmpu); 166 int sb_mixer_init(sb_devc *devc, struct module *owner); 167 void sb_mixer_unload(sb_devc *devc); 168 void sb_mixer_set_stereo (sb_devc *devc, int mode); 169 void smw_mixer_init(sb_devc *devc); 170 void sb_dsp_midi_init (sb_devc *devc, struct module *owner); 171 void sb_audio_init (sb_devc *devc, char *name, struct module *owner); 172 void sb_midi_interrupt (sb_devc *devc); 173 void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val); 174 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right); 175 176 int sb_audio_open(int dev, int mode); 177 void sb_audio_close(int dev); 178 179 /* From sb_common.c */ 180 void sb_dsp_disable_midi(int port); 181 int probe_sbmpu (struct address_info *hw_config, struct module *owner); 182 void unload_sbmpu (struct address_info *hw_config); 183 184 void unload_sb16(struct address_info *hw_info); 185 void unload_sb16midi(struct address_info *hw_info); 186