xref: /reactos/drivers/wdm/audio/drivers/ac97/ac97reg.h (revision 9c79a798)
1 /********************************************************************************
2 **    Copyright (c) 1998-2000 Microsoft Corporation. All Rights Reserved.
3 **
4 **       Portions Copyright (c) 1998-1999 Intel Corporation
5 **
6 ********************************************************************************/
7 
8 /* The file ac97reg.h was reviewed by LCA in June 2011 and is acceptable for use by Microsoft. */
9 
10 #ifndef _AC97REG_H_
11 #define _AC97REG_H_
12 
13 // We use enum types cause the compiler can check variable passing if it is
14 // an enum (otherwise you could pass any value). That doesn't save us from
15 // doing reasonable run time checks in that range.
16 enum AC97Register
17 {
18     AC97REG_RESET = 0,
19     AC97REG_MASTER_VOLUME,
20     AC97REG_HPHONE_VOLUME,
21     AC97REG_MMONO_VOLUME,
22     AC97REG_MASTER_TONE,
23     AC97REG_BEEP_VOLUME,
24     AC97REG_PHONE_VOLUME,
25     AC97REG_MIC_VOLUME,
26     AC97REG_LINE_IN_VOLUME,
27     AC97REG_CD_VOLUME,
28     AC97REG_VIDEO_VOLUME,
29     AC97REG_AUX_VOLUME,
30     AC97REG_PCM_OUT_VOLUME,
31     AC97REG_RECORD_SELECT,
32     AC97REG_RECORD_GAIN,
33     AC97REG_RECORD_GAIN_MIC,
34     AC97REG_GENERAL,
35     AC97REG_3D_CONTROL,
36     AC97REG_RESERVED,
37     AC97REG_POWERDOWN,
38 
39     // AC97-2.0 registers
40     AC97REG_EXT_AUDIO_ID,
41     AC97REG_EXT_AUDIO_CTRL,
42     AC97REG_FRONT_SAMPLERATE,
43     AC97REG_SURROUND_SAMPLERATE,
44     AC97REG_LFE_SAMPLERATE,
45     AC97REG_RECORD_SAMPLERATE,
46     AC97REG_MIC_SAMPLERATE,
47     AC97REG_CENTER_LFE_VOLUME,
48     AC97REG_SURROUND_VOLUME,
49     AC97REG_RESERVED2,
50 
51     // Modem registers from 0x3C to 0x58 (next 15 enums)
52     // Vendor Reserved = 0x5A-0x7A (next 16 enums)
53 
54     // Vendor IDs
55     AC97REG_VENDOR_ID1 = 0x3E,      // thats register address 0x7C
56     AC97REG_VENDOR_ID2,
57 
58     // Defines an invalid register. Likewise, this is the highest
59     // possible value that can be used.
60     AC97REG_INVALID
61 };
62 
63 #if (DBG)
64 // Note: This array only has the first 29 registers defined.
65 //       There are many more.
66 const PCHAR RegStrings[] =
67 {
68     "REG_RESET",
69     "REG_MASTER_VOLUME",
70     "REG_HPHONE_VOLUME",
71     "REG_MMONO_VOLUME",
72     "REG_MASTER_TONE",
73     "REG_BEEP_VOLUME",
74     "REG_PHONE_VOLUME",
75     "REG_MIC_VOLUME",
76     "REG_LINEIN_VOLUME",
77     "REG_CD_VOLUME",
78     "REG_VIDEO_VOLUME",
79     "REG_AUX_VOLUME",
80     "REG_PCMOUT_VOLUME",
81     "REG_RECORD_SELECT",
82     "REG_RECORD_GAIN",
83     "REG_RECORD_GAIN_MIC",
84     "REG_GENERAL",
85     "REG_3D_CONTROL",
86     "REG_RESERVED",
87     "REG_POWERDOWN",
88     "REG_EXT_AUDIO_ID",
89     "REG_EXT_AUDIO_CTRL",
90     "REG_FRONT_SAMPLERATE",
91     "REG_SURROUND_SAMPLERATE",
92     "REG_LFE_SAMPLERATE",
93     "REG_RECORD_SAMPLERATE",
94     "REG_MIC_SAMPLERATE",
95     "REG_CENTER_LFE_VOLUME",
96     "REG_SURROUND_VOLUME",
97     "REG_RESERVED2"
98 };
99 #endif
100 
101 // This array maps the node controls to the AC97 registers.
102 // E.g. if you mute the master volume control you should modify AC97
103 // register AC97REG_MASTER_VOLUME
104 typedef struct {
105     AC97Register    reg;    // we would only need one byte, but enums are int
106     WORD            mask;   // registers are 16 bit.
107 } tMapNodeToReg;
108 
109 const tMapNodeToReg stMapNodeToReg[] =
110 {
111     // TODO: loopback
112     {AC97REG_PCM_OUT_VOLUME, 0x1F1F},   // NODE_WAVEOUT_VOLUME
113     {AC97REG_PCM_OUT_VOLUME, 0x8000},   // NODE_WAVEOUT_MUTE
114     {AC97REG_GENERAL, 0x8000},          // NODE_VIRT_WAVEOUT_3D_BYPASS
115     {AC97REG_BEEP_VOLUME, 0x001E},      // NODE_PCBEEP_VOLUME
116     {AC97REG_BEEP_VOLUME, 0x8000},      // NODE_PCBEEP_MUTE
117     {AC97REG_PHONE_VOLUME, 0x001F},     // NODE_PHONE_VOLUME
118     {AC97REG_PHONE_VOLUME, 0x8000},     // NODE_PHONE_MUTE
119     {AC97REG_GENERAL, 0x0100},          // NODE_MIC_SELECT
120     {AC97REG_MIC_VOLUME, 0x0040},       // NODE_MIC_BOOST
121     {AC97REG_MIC_VOLUME, 0x001F},       // NODE_MIC_VOLUME
122     {AC97REG_MIC_VOLUME, 0x8000},       // NODE_MIC_MUTE
123     {AC97REG_LINE_IN_VOLUME, 0x1F1F},   // NODE_LINEIN_VOLUME
124     {AC97REG_LINE_IN_VOLUME, 0x8000},   // NODE_LINEIN_MUTE
125     {AC97REG_CD_VOLUME, 0x1F1F},        // NODE_CD_VOLUME
126     {AC97REG_CD_VOLUME, 0x8000},        // NODE_CD_MUTE
127     {AC97REG_VIDEO_VOLUME, 0x1F1F},     // NODE_VIDEO_VOLUME
128     {AC97REG_VIDEO_VOLUME, 0x8000},     // NODE_VIDEO_MUTE
129     {AC97REG_AUX_VOLUME, 0x1F1F},       // NODE_AUX_VOLUME
130     {AC97REG_AUX_VOLUME, 0x8000},       // NODE_AUX_MUTE
131     {AC97REG_INVALID, 0x0000},          // NODE_MAIN_MIX doesn't has controls
132     {AC97REG_3D_CONTROL, 0x0F00},       // NODE_VIRT_3D_CENTER
133     {AC97REG_3D_CONTROL, 0x000F},       // NODE_VIRT_3D_DEPTH
134     {AC97REG_GENERAL, 0x2000},          // NODE_VIRT_3D_ENABLE
135     {AC97REG_INVALID, 0x0000},          // NODE_BEEP_MIX doesn't has controls
136     {AC97REG_MASTER_TONE, 0x0F00},      // NODE_BASS
137     {AC97REG_MASTER_TONE, 0x000F},      // NODE_TREBLE
138     {AC97REG_GENERAL, 0x1000},          // NODE_LOUDNESS
139     {AC97REG_GENERAL, 0x4000},          // NODE_SIMUL_STEREO
140     {AC97REG_MASTER_VOLUME, 0x3F3F},    // NODE_MASTEROUT_VOLUME
141     {AC97REG_MASTER_VOLUME, 0x8000},    // NODE_MASTEROUT_MUTE
142     {AC97REG_HPHONE_VOLUME, 0x3F3F},    // NODE_HPHONE_VOLUME
143     {AC97REG_HPHONE_VOLUME, 0x8000},    // NODE_HPHONE_MUTE
144     {AC97REG_GENERAL, 0x0200},          // NODE_MONOOUT_SELECT
145     {AC97REG_MMONO_VOLUME, 0x803F},     // NODE_VIRT_MONOOUT_VOLUME1
146     {AC97REG_MMONO_VOLUME, 0x803F},     // NODE_VIRT_MONOOUT_VOLUME2
147     {AC97REG_RECORD_SELECT, 0x0707},    // NODE_WAVEIN_SELECT
148     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME1
149     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME2
150     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME3
151     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME4
152     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME5
153     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME6
154     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME7
155     {AC97REG_RECORD_GAIN, 0x0F0F},      // NODE_VIRT_MASTER_INPUT_VOLUME8
156     {AC97REG_RECORD_GAIN_MIC, 0x000F},  // NODE_MICIN_VOLUME
157     {AC97REG_RECORD_GAIN_MIC, 0x8000},  // NODE_MICIN_MUTE
158     {AC97REG_SURROUND_VOLUME, 0x3F3F},  // NODE_SURROUND_VOLUME
159     {AC97REG_SURROUND_VOLUME, 0x8080},  // NODE_SURROUND_MUTE
160     {AC97REG_CENTER_LFE_VOLUME, 0x3F00},// NODE_CENTER_VOLUME
161     {AC97REG_CENTER_LFE_VOLUME, 0x8000},// NODE_CENTER_MUTE
162     {AC97REG_CENTER_LFE_VOLUME, 0x003F},// NODE_LFE_VOLUME
163     {AC97REG_CENTER_LFE_VOLUME, 0x0080},// NODE_LFE_MUTE
164     {AC97REG_MASTER_VOLUME, 0x3F3F},    // NODE_FRONT_VOLUME
165     {AC97REG_MASTER_VOLUME, 0x8000},    // NODE_FRONT_MUTE
166     {AC97REG_INVALID, 0x0000},          // NODE_VIRT_MASTERMONO_VOLUME doesn't have controls
167     {AC97REG_INVALID, 0x0000}           // NODE_VIRT_MASTERMONO_MUTE doesn't have controls
168 };
169 
170 #endif  //_AC97REG_H_
171