1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef __SOUND_AZT3328_H 3*4882a593Smuzhiyun #define __SOUND_AZT3328_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun /* "PU" == "power-up value", as tested on PCI168 PCI rev. 10 6*4882a593Smuzhiyun * "WRITE_ONLY" == register does not indicate actual bit values */ 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun /*** main I/O area port indices ***/ 9*4882a593Smuzhiyun /* (only 0x70 of 0x80 bytes saved/restored by Windows driver) */ 10*4882a593Smuzhiyun #define AZF_IO_SIZE_CTRL 0x80 11*4882a593Smuzhiyun #define AZF_IO_SIZE_CTRL_PM 0x70 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /* the driver initialisation suggests a layout of 4 areas 14*4882a593Smuzhiyun * within the main card control I/O: 15*4882a593Smuzhiyun * from 0x00 (playback codec), from 0x20 (recording codec) 16*4882a593Smuzhiyun * and from 0x40 (most certainly I2S out codec). 17*4882a593Smuzhiyun * And another area from 0x60 to 0x6f (DirectX timer, IRQ management, 18*4882a593Smuzhiyun * power management etc.???). */ 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun #define AZF_IO_OFFS_CODEC_PLAYBACK 0x00 21*4882a593Smuzhiyun #define AZF_IO_OFFS_CODEC_CAPTURE 0x20 22*4882a593Smuzhiyun #define AZF_IO_OFFS_CODEC_I2S_OUT 0x40 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_FLAGS 0x00 /* PU:0x0000 */ 25*4882a593Smuzhiyun /* able to reactivate output after output muting due to 8/16bit 26*4882a593Smuzhiyun * output change, just like 0x0002. 27*4882a593Smuzhiyun * 0x0001 is the only bit that's able to start the DMA counter */ 28*4882a593Smuzhiyun #define DMA_RESUME 0x0001 /* paused if cleared? */ 29*4882a593Smuzhiyun /* 0x0002 *temporarily* set during DMA stopping. hmm 30*4882a593Smuzhiyun * both 0x0002 and 0x0004 set in playback setup. */ 31*4882a593Smuzhiyun /* able to reactivate output after output muting due to 8/16bit 32*4882a593Smuzhiyun * output change, just like 0x0001. */ 33*4882a593Smuzhiyun #define DMA_RUN_SOMETHING1 0x0002 /* \ alternated (toggled) */ 34*4882a593Smuzhiyun /* 0x0004: NOT able to reactivate output */ 35*4882a593Smuzhiyun #define DMA_RUN_SOMETHING2 0x0004 /* / bits */ 36*4882a593Smuzhiyun #define SOMETHING_ALMOST_ALWAYS_SET 0x0008 /* ???; can be modified */ 37*4882a593Smuzhiyun #define DMA_EPILOGUE_SOMETHING 0x0010 38*4882a593Smuzhiyun #define DMA_SOMETHING_ELSE 0x0020 /* ??? */ 39*4882a593Smuzhiyun #define SOMETHING_UNMODIFIABLE 0xffc0 /* unused? not modifiable */ 40*4882a593Smuzhiyun #define IDX_IO_CODEC_IRQTYPE 0x02 /* PU:0x0001 */ 41*4882a593Smuzhiyun /* write back to flags in case flags are set, in order to ACK IRQ in handler 42*4882a593Smuzhiyun * (bit 1 of port 0x64 indicates interrupt for one of these three types) 43*4882a593Smuzhiyun * sometimes in this case it just writes 0xffff to globally ACK all IRQs 44*4882a593Smuzhiyun * settings written are not reflected when reading back, though. 45*4882a593Smuzhiyun * seems to be IRQ, too (frequently used: port |= 0x07 !), but who knows? */ 46*4882a593Smuzhiyun #define IRQ_SOMETHING 0x0001 /* something & ACK */ 47*4882a593Smuzhiyun #define IRQ_FINISHED_DMABUF_1 0x0002 /* 1st dmabuf finished & ACK */ 48*4882a593Smuzhiyun #define IRQ_FINISHED_DMABUF_2 0x0004 /* 2nd dmabuf finished & ACK */ 49*4882a593Smuzhiyun #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ 50*4882a593Smuzhiyun #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ 51*4882a593Smuzhiyun #define IRQMASK_UNMODIFIABLE 0xffe0 /* unused? not modifiable */ 52*4882a593Smuzhiyun /* start address of 1st DMA transfer area, PU:0x00000000 */ 53*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_START_1 0x04 54*4882a593Smuzhiyun /* start address of 2nd DMA transfer area, PU:0x00000000 */ 55*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_START_2 0x08 56*4882a593Smuzhiyun /* both lengths of DMA transfer areas, PU:0x00000000 57*4882a593Smuzhiyun length1: offset 0x0c, length2: offset 0x0e */ 58*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_LENGTHS 0x0c 59*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_CURRPOS 0x10 /* current DMA position, PU:0x00000000 */ 60*4882a593Smuzhiyun /* offset within current DMA transfer area, PU:0x0000 */ 61*4882a593Smuzhiyun #define IDX_IO_CODEC_DMA_CURROFS 0x14 62*4882a593Smuzhiyun #define IDX_IO_CODEC_SOUNDFORMAT 0x16 /* PU:0x0010 */ 63*4882a593Smuzhiyun /* all unspecified bits can't be modified */ 64*4882a593Smuzhiyun #define SOUNDFORMAT_FREQUENCY_MASK 0x000f 65*4882a593Smuzhiyun #define SOUNDFORMAT_XTAL1 0x00 66*4882a593Smuzhiyun #define SOUNDFORMAT_XTAL2 0x01 67*4882a593Smuzhiyun /* all _SUSPECTED_ values are not used by Windows drivers, so we don't 68*4882a593Smuzhiyun * have any hard facts, only rough measurements. 69*4882a593Smuzhiyun * All we know is that the crystal used on the board has 24.576MHz, 70*4882a593Smuzhiyun * like many soundcards (which results in the frequencies below when 71*4882a593Smuzhiyun * using certain divider values selected by the values below) */ 72*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_SUSPECTED_4000 0x0c | SOUNDFORMAT_XTAL1 73*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_SUSPECTED_4800 0x0a | SOUNDFORMAT_XTAL1 74*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_5510 0x0c | SOUNDFORMAT_XTAL2 75*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_6620 0x0a | SOUNDFORMAT_XTAL2 76*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_8000 0x00 | SOUNDFORMAT_XTAL1 /* also 0x0e | SOUNDFORMAT_XTAL1? */ 77*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_9600 0x08 | SOUNDFORMAT_XTAL1 78*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_11025 0x00 | SOUNDFORMAT_XTAL2 /* also 0x0e | SOUNDFORMAT_XTAL2? */ 79*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_SUSPECTED_13240 0x08 | SOUNDFORMAT_XTAL2 /* seems to be 6620 *2 */ 80*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_16000 0x02 | SOUNDFORMAT_XTAL1 81*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_22050 0x02 | SOUNDFORMAT_XTAL2 82*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_32000 0x04 | SOUNDFORMAT_XTAL1 83*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_44100 0x04 | SOUNDFORMAT_XTAL2 84*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_48000 0x06 | SOUNDFORMAT_XTAL1 85*4882a593Smuzhiyun #define SOUNDFORMAT_FREQ_SUSPECTED_66200 0x06 | SOUNDFORMAT_XTAL2 /* 66200 (13240 * 5); 64000 may have been nicer :-\ */ 86*4882a593Smuzhiyun #define SOUNDFORMAT_FLAG_16BIT 0x0010 87*4882a593Smuzhiyun #define SOUNDFORMAT_FLAG_2CHANNELS 0x0020 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun /* define frequency helpers, for maximum value safety */ 91*4882a593Smuzhiyun enum azf_freq_t { 92*4882a593Smuzhiyun #define AZF_FREQ(rate) AZF_FREQ_##rate = rate 93*4882a593Smuzhiyun AZF_FREQ(4000), 94*4882a593Smuzhiyun AZF_FREQ(4800), 95*4882a593Smuzhiyun AZF_FREQ(5512), 96*4882a593Smuzhiyun AZF_FREQ(6620), 97*4882a593Smuzhiyun AZF_FREQ(8000), 98*4882a593Smuzhiyun AZF_FREQ(9600), 99*4882a593Smuzhiyun AZF_FREQ(11025), 100*4882a593Smuzhiyun AZF_FREQ(13240), 101*4882a593Smuzhiyun AZF_FREQ(16000), 102*4882a593Smuzhiyun AZF_FREQ(22050), 103*4882a593Smuzhiyun AZF_FREQ(32000), 104*4882a593Smuzhiyun AZF_FREQ(44100), 105*4882a593Smuzhiyun AZF_FREQ(48000), 106*4882a593Smuzhiyun AZF_FREQ(66200), 107*4882a593Smuzhiyun #undef AZF_FREQ 108*4882a593Smuzhiyun }; 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun /** DirectX timer, main interrupt area (FIXME: and something else?) **/ 111*4882a593Smuzhiyun #define IDX_IO_TIMER_VALUE 0x60 /* found this timer area by pure luck :-) */ 112*4882a593Smuzhiyun /* timer countdown value; triggers IRQ when timer is finished */ 113*4882a593Smuzhiyun #define TIMER_VALUE_MASK 0x000fffffUL 114*4882a593Smuzhiyun /* activate timer countdown */ 115*4882a593Smuzhiyun #define TIMER_COUNTDOWN_ENABLE 0x01000000UL 116*4882a593Smuzhiyun /* trigger timer IRQ on zero transition */ 117*4882a593Smuzhiyun #define TIMER_IRQ_ENABLE 0x02000000UL 118*4882a593Smuzhiyun /* being set in IRQ handler in case port 0x00 (hmm, not port 0x64!?!?) 119*4882a593Smuzhiyun * had 0x0020 set upon IRQ handler */ 120*4882a593Smuzhiyun #define TIMER_IRQ_ACK 0x04000000UL 121*4882a593Smuzhiyun #define IDX_IO_IRQSTATUS 0x64 122*4882a593Smuzhiyun /* some IRQ bit in here might also be used to signal a power-management timer 123*4882a593Smuzhiyun * timeout, to request shutdown of the chip (e.g. AD1815JS has such a thing). 124*4882a593Smuzhiyun * OPL3 hardware contains several timers which confusingly in most cases 125*4882a593Smuzhiyun * are NOT routed to an IRQ, but some designs (e.g. LM4560) DO support that, 126*4882a593Smuzhiyun * so I wouldn't be surprised at all to discover that AZF3328 127*4882a593Smuzhiyun * supports that thing as well... */ 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun #define IRQ_PLAYBACK 0x0001 130*4882a593Smuzhiyun #define IRQ_RECORDING 0x0002 131*4882a593Smuzhiyun #define IRQ_I2S_OUT 0x0004 /* this IS I2S, right!? (untested) */ 132*4882a593Smuzhiyun #define IRQ_GAMEPORT 0x0008 /* Interrupt of Digital(ly) Enhanced Game Port */ 133*4882a593Smuzhiyun #define IRQ_MPU401 0x0010 134*4882a593Smuzhiyun #define IRQ_TIMER 0x0020 /* DirectX timer */ 135*4882a593Smuzhiyun #define IRQ_UNKNOWN2 0x0040 /* probably unused, or possibly OPL3 timer? */ 136*4882a593Smuzhiyun #define IRQ_UNKNOWN3 0x0080 /* probably unused, or possibly OPL3 timer? */ 137*4882a593Smuzhiyun #define IDX_IO_66H 0x66 /* writing 0xffff returns 0x0000 */ 138*4882a593Smuzhiyun /* this is set to e.g. 0x3ff or 0x300, and writable; 139*4882a593Smuzhiyun * maybe some buffer limit, but I couldn't find out more, PU:0x00ff: */ 140*4882a593Smuzhiyun #define IDX_IO_SOME_VALUE 0x68 141*4882a593Smuzhiyun #define IO_68_RANDOM_TOGGLE1 0x0100 /* toggles randomly */ 142*4882a593Smuzhiyun #define IO_68_RANDOM_TOGGLE2 0x0200 /* toggles randomly */ 143*4882a593Smuzhiyun /* umm, nope, behaviour of these bits changes depending on what we wrote 144*4882a593Smuzhiyun * to 0x6b!! 145*4882a593Smuzhiyun * And they change upon playback/stop, too: 146*4882a593Smuzhiyun * Writing a value to 0x68 will display this exact value during playback, 147*4882a593Smuzhiyun * too but when stopped it can fall back to a rather different 148*4882a593Smuzhiyun * seemingly random value). Hmm, possibly this is a register which 149*4882a593Smuzhiyun * has a remote shadow which needs proper device supply which only exists 150*4882a593Smuzhiyun * in case playback is active? Or is this driver-induced? 151*4882a593Smuzhiyun */ 152*4882a593Smuzhiyun 153*4882a593Smuzhiyun /* this WORD can be set to have bits 0x0028 activated (FIXME: correct??); 154*4882a593Smuzhiyun * actually inhibits PCM playback!!! maybe power management??: */ 155*4882a593Smuzhiyun #define IDX_IO_6AH 0x6A /* WRITE_ONLY! */ 156*4882a593Smuzhiyun /* bit 5: enabling this will activate permanent counting of bytes 2/3 157*4882a593Smuzhiyun * at gameport I/O (0xb402/3) (equal values each) and cause 158*4882a593Smuzhiyun * gameport legacy I/O at 0x0200 to be _DISABLED_! 159*4882a593Smuzhiyun * Is this Digital Enhanced Game Port Enable??? Or maybe it's Testmode 160*4882a593Smuzhiyun * for Enhanced Digital Gameport (see 4D Wave DX card): */ 161*4882a593Smuzhiyun #define IO_6A_SOMETHING1_GAMEPORT 0x0020 162*4882a593Smuzhiyun /* bit 8; sure, this _pauses_ playback (later resumes at same spot!), 163*4882a593Smuzhiyun * but what the heck is this really about??: */ 164*4882a593Smuzhiyun #define IO_6A_PAUSE_PLAYBACK_BIT8 0x0100 165*4882a593Smuzhiyun /* bit 9; sure, this _pauses_ playback (later resumes at same spot!), 166*4882a593Smuzhiyun * but what the heck is this really about??: */ 167*4882a593Smuzhiyun #define IO_6A_PAUSE_PLAYBACK_BIT9 0x0200 168*4882a593Smuzhiyun /* BIT8 and BIT9 are _NOT_ able to affect OPL3 MIDI playback, 169*4882a593Smuzhiyun * thus it suggests influence on PCM only!! 170*4882a593Smuzhiyun * However OTOH there seems to be no bit anywhere around here 171*4882a593Smuzhiyun * which is able to disable OPL3... */ 172*4882a593Smuzhiyun /* bit 10: enabling this actually changes values at legacy gameport 173*4882a593Smuzhiyun * I/O address (0x200); is this enabling of the Digital Enhanced Game Port??? 174*4882a593Smuzhiyun * Or maybe this simply switches off the NE558 circuit, since enabling this 175*4882a593Smuzhiyun * still lets us evaluate button states, but not axis states */ 176*4882a593Smuzhiyun #define IO_6A_SOMETHING2_GAMEPORT 0x0400 177*4882a593Smuzhiyun /* writing 0x0300: causes quite some crackling during 178*4882a593Smuzhiyun * PC activity such as switching windows (PCI traffic?? 179*4882a593Smuzhiyun * --> FIFO/timing settings???) */ 180*4882a593Smuzhiyun /* writing 0x0100 plus/or 0x0200 inhibits playback */ 181*4882a593Smuzhiyun /* since the Windows .INF file has Flag_Enable_JoyStick and 182*4882a593Smuzhiyun * Flag_Enable_SB_DOS_Emulation directly together, it stands to reason 183*4882a593Smuzhiyun * that some other bit in this same register might be responsible 184*4882a593Smuzhiyun * for SB DOS Emulation activation (note that the file did NOT define 185*4882a593Smuzhiyun * a switch for OPL3!) */ 186*4882a593Smuzhiyun #define IDX_IO_6CH 0x6C /* unknown; fully read-writable */ 187*4882a593Smuzhiyun #define IDX_IO_6EH 0x6E 188*4882a593Smuzhiyun /* writing 0xffff returns 0x83fe (or 0x03fe only). 189*4882a593Smuzhiyun * writing 0x83 (and only 0x83!!) to 0x6f will cause 0x6c to switch 190*4882a593Smuzhiyun * from 0000 to ffff. */ 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun /* further I/O indices not saved/restored and not readable after writing, 193*4882a593Smuzhiyun * so probably not used */ 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun /*** Gameport area port indices ***/ 197*4882a593Smuzhiyun /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ 198*4882a593Smuzhiyun #define AZF_IO_SIZE_GAME 0x08 199*4882a593Smuzhiyun #define AZF_IO_SIZE_GAME_PM 0x06 200*4882a593Smuzhiyun 201*4882a593Smuzhiyun enum { 202*4882a593Smuzhiyun AZF_GAME_LEGACY_IO_PORT = 0x200 203*4882a593Smuzhiyun }; 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun #define IDX_GAME_LEGACY_COMPATIBLE 0x00 206*4882a593Smuzhiyun /* in some operation mode, writing anything to this port 207*4882a593Smuzhiyun * triggers an interrupt: 208*4882a593Smuzhiyun * yup, that's in case IDX_GAME_01H has one of the 209*4882a593Smuzhiyun * axis measurement bits enabled 210*4882a593Smuzhiyun * (and of course one needs to have GAME_HWCFG_IRQ_ENABLE, too) */ 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun #define IDX_GAME_AXES_CONFIG 0x01 213*4882a593Smuzhiyun /* NOTE: layout of this register awfully similar (read: "identical??") 214*4882a593Smuzhiyun * to AD1815JS.pdf (p.29) */ 215*4882a593Smuzhiyun 216*4882a593Smuzhiyun /* enables axis 1 (X axis) measurement: */ 217*4882a593Smuzhiyun #define GAME_AXES_ENABLE_1 0x01 218*4882a593Smuzhiyun /* enables axis 2 (Y axis) measurement: */ 219*4882a593Smuzhiyun #define GAME_AXES_ENABLE_2 0x02 220*4882a593Smuzhiyun /* enables axis 3 (X axis) measurement: */ 221*4882a593Smuzhiyun #define GAME_AXES_ENABLE_3 0x04 222*4882a593Smuzhiyun /* enables axis 4 (Y axis) measurement: */ 223*4882a593Smuzhiyun #define GAME_AXES_ENABLE_4 0x08 224*4882a593Smuzhiyun /* selects the current axis to read the measured value of 225*4882a593Smuzhiyun * (at IDX_GAME_AXIS_VALUE): 226*4882a593Smuzhiyun * 00 = axis 1, 01 = axis 2, 10 = axis 3, 11 = axis 4: */ 227*4882a593Smuzhiyun #define GAME_AXES_READ_MASK 0x30 228*4882a593Smuzhiyun /* enable to have the latch continuously accept ADC values 229*4882a593Smuzhiyun * (and continuously cause interrupts in case interrupts are enabled); 230*4882a593Smuzhiyun * AD1815JS.pdf says it's ~16ms interval there: */ 231*4882a593Smuzhiyun #define GAME_AXES_LATCH_ENABLE 0x40 232*4882a593Smuzhiyun /* joystick data (measured axes) ready for reading: */ 233*4882a593Smuzhiyun #define GAME_AXES_SAMPLING_READY 0x80 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun /* NOTE: other card specs (SiS960 and others!) state that the 236*4882a593Smuzhiyun * game position latches should be frozen when reading and be freed 237*4882a593Smuzhiyun * (== reset?) after reading!!! 238*4882a593Smuzhiyun * Freezing most likely means disabling 0x40 (GAME_AXES_LATCH_ENABLE), 239*4882a593Smuzhiyun * but how to free the value? */ 240*4882a593Smuzhiyun /* An internet search for "gameport latch ADC" should provide some insight 241*4882a593Smuzhiyun * into how to program such a gameport system. */ 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun /* writing 0xf0 to 01H once reset both counters to 0, in some special mode!? 244*4882a593Smuzhiyun * yup, in case 6AH 0x20 is not enabled 245*4882a593Smuzhiyun * (and 0x40 is sufficient, 0xf0 is not needed) */ 246*4882a593Smuzhiyun 247*4882a593Smuzhiyun #define IDX_GAME_AXIS_VALUE 0x02 248*4882a593Smuzhiyun /* R: value of currently configured axis (word value!); 249*4882a593Smuzhiyun * W: trigger axis measurement */ 250*4882a593Smuzhiyun 251*4882a593Smuzhiyun #define IDX_GAME_HWCONFIG 0x04 252*4882a593Smuzhiyun /* note: bits 4 to 7 are never set (== 0) when reading! 253*4882a593Smuzhiyun * --> reserved bits? */ 254*4882a593Smuzhiyun /* enables IRQ notification upon axes measurement ready: */ 255*4882a593Smuzhiyun #define GAME_HWCFG_IRQ_ENABLE 0x01 256*4882a593Smuzhiyun /* these bits choose a different frequency for the 257*4882a593Smuzhiyun * internal ADC counter increment. 258*4882a593Smuzhiyun * hmm, seems to be a combo of bits: 259*4882a593Smuzhiyun * 00 --> standard frequency 260*4882a593Smuzhiyun * 10 --> 1/2 261*4882a593Smuzhiyun * 01 --> 1/20 262*4882a593Smuzhiyun * 11 --> 1/200: */ 263*4882a593Smuzhiyun #define GAME_HWCFG_ADC_COUNTER_FREQ_MASK 0x06 264*4882a593Smuzhiyun 265*4882a593Smuzhiyun /* FIXME: these values might be reversed... */ 266*4882a593Smuzhiyun #define GAME_HWCFG_ADC_COUNTER_FREQ_STD 0 267*4882a593Smuzhiyun #define GAME_HWCFG_ADC_COUNTER_FREQ_1_2 1 268*4882a593Smuzhiyun #define GAME_HWCFG_ADC_COUNTER_FREQ_1_20 2 269*4882a593Smuzhiyun #define GAME_HWCFG_ADC_COUNTER_FREQ_1_200 3 270*4882a593Smuzhiyun 271*4882a593Smuzhiyun /* enable gameport legacy I/O address (0x200) 272*4882a593Smuzhiyun * I was unable to locate any configurability for a different address: */ 273*4882a593Smuzhiyun #define GAME_HWCFG_LEGACY_ADDRESS_ENABLE 0x08 274*4882a593Smuzhiyun 275*4882a593Smuzhiyun /*** MPU401 ***/ 276*4882a593Smuzhiyun #define AZF_IO_SIZE_MPU 0x04 277*4882a593Smuzhiyun #define AZF_IO_SIZE_MPU_PM 0x04 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun /*** OPL3 synth ***/ 280*4882a593Smuzhiyun /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ 281*4882a593Smuzhiyun #define AZF_IO_SIZE_OPL3 0x08 282*4882a593Smuzhiyun #define AZF_IO_SIZE_OPL3_PM 0x06 283*4882a593Smuzhiyun /* hmm, given that a standard OPL3 has 4 registers only, 284*4882a593Smuzhiyun * there might be some enhanced functionality lurking at the end 285*4882a593Smuzhiyun * (especially since register 0x04 has a "non-empty" value 0xfe) */ 286*4882a593Smuzhiyun 287*4882a593Smuzhiyun /*** mixer I/O area port indices ***/ 288*4882a593Smuzhiyun /* (only 0x22 of 0x40 bytes saved/restored by Windows driver) 289*4882a593Smuzhiyun * UNFORTUNATELY azf3328 is NOT truly AC97 compliant: see main file intro */ 290*4882a593Smuzhiyun #define AZF_IO_SIZE_MIXER 0x40 291*4882a593Smuzhiyun #define AZF_IO_SIZE_MIXER_PM 0x22 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun #define MIXER_VOLUME_RIGHT_MASK 0x001f 294*4882a593Smuzhiyun #define MIXER_VOLUME_LEFT_MASK 0x1f00 295*4882a593Smuzhiyun #define MIXER_MUTE_MASK 0x8000 296*4882a593Smuzhiyun #define IDX_MIXER_RESET 0x00 /* does NOT seem to have AC97 ID bits */ 297*4882a593Smuzhiyun #define IDX_MIXER_PLAY_MASTER 0x02 298*4882a593Smuzhiyun #define IDX_MIXER_MODEMOUT 0x04 299*4882a593Smuzhiyun #define IDX_MIXER_BASSTREBLE 0x06 300*4882a593Smuzhiyun #define MIXER_BASSTREBLE_TREBLE_VOLUME_MASK 0x000e 301*4882a593Smuzhiyun #define MIXER_BASSTREBLE_BASS_VOLUME_MASK 0x0e00 302*4882a593Smuzhiyun #define IDX_MIXER_PCBEEP 0x08 303*4882a593Smuzhiyun #define IDX_MIXER_MODEMIN 0x0a 304*4882a593Smuzhiyun #define IDX_MIXER_MIC 0x0c 305*4882a593Smuzhiyun #define MIXER_MIC_MICGAIN_20DB_ENHANCEMENT_MASK 0x0040 306*4882a593Smuzhiyun #define IDX_MIXER_LINEIN 0x0e 307*4882a593Smuzhiyun #define IDX_MIXER_CDAUDIO 0x10 308*4882a593Smuzhiyun #define IDX_MIXER_VIDEO 0x12 309*4882a593Smuzhiyun #define IDX_MIXER_AUX 0x14 310*4882a593Smuzhiyun #define IDX_MIXER_WAVEOUT 0x16 311*4882a593Smuzhiyun #define IDX_MIXER_FMSYNTH 0x18 312*4882a593Smuzhiyun #define IDX_MIXER_REC_SELECT 0x1a 313*4882a593Smuzhiyun #define MIXER_REC_SELECT_MIC 0x00 314*4882a593Smuzhiyun #define MIXER_REC_SELECT_CD 0x01 315*4882a593Smuzhiyun #define MIXER_REC_SELECT_VIDEO 0x02 316*4882a593Smuzhiyun #define MIXER_REC_SELECT_AUX 0x03 317*4882a593Smuzhiyun #define MIXER_REC_SELECT_LINEIN 0x04 318*4882a593Smuzhiyun #define MIXER_REC_SELECT_MIXSTEREO 0x05 319*4882a593Smuzhiyun #define MIXER_REC_SELECT_MIXMONO 0x06 320*4882a593Smuzhiyun #define MIXER_REC_SELECT_MONOIN 0x07 321*4882a593Smuzhiyun #define IDX_MIXER_REC_VOLUME 0x1c 322*4882a593Smuzhiyun #define IDX_MIXER_ADVCTL1 0x1e 323*4882a593Smuzhiyun /* unlisted bits are unmodifiable */ 324*4882a593Smuzhiyun #define MIXER_ADVCTL1_3DWIDTH_MASK 0x000e 325*4882a593Smuzhiyun #define MIXER_ADVCTL1_HIFI3D_MASK 0x0300 /* yup, this is missing the high bit that official AC97 contains, plus it doesn't have linear bit value range behaviour but instead acts weirdly (possibly we're dealing with two *different* 3D settings here??) */ 326*4882a593Smuzhiyun #define IDX_MIXER_ADVCTL2 0x20 /* subset of AC97_GENERAL_PURPOSE reg! */ 327*4882a593Smuzhiyun /* unlisted bits are unmodifiable */ 328*4882a593Smuzhiyun #define MIXER_ADVCTL2_LPBK 0x0080 /* Loopback mode -- Win driver: "WaveOut3DBypass"? mutes WaveOut at LineOut */ 329*4882a593Smuzhiyun #define MIXER_ADVCTL2_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 -- Win driver: "ModemOutSelect"?? */ 330*4882a593Smuzhiyun #define MIXER_ADVCTL2_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic; Win driver: "MonoSelectSource"?? */ 331*4882a593Smuzhiyun #define MIXER_ADVCTL2_3D 0x2000 /* 3D Enhancement 1=on */ 332*4882a593Smuzhiyun #define MIXER_ADVCTL2_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ 333*4882a593Smuzhiyun 334*4882a593Smuzhiyun #define IDX_MIXER_SOMETHING30H 0x30 /* used, but unknown??? */ 335*4882a593Smuzhiyun 336*4882a593Smuzhiyun /* driver internal flags */ 337*4882a593Smuzhiyun #define SET_CHAN_LEFT 1 338*4882a593Smuzhiyun #define SET_CHAN_RIGHT 2 339*4882a593Smuzhiyun 340*4882a593Smuzhiyun /* helper macro to align I/O port ranges to 32bit I/O width */ 341*4882a593Smuzhiyun #define AZF_ALIGN(x) (((x) + 3) & (~3)) 342*4882a593Smuzhiyun 343*4882a593Smuzhiyun #endif /* __SOUND_AZT3328_H */ 344