1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 #ifndef _DEV_PCI_CMPCIVAR_H_
39 #define _DEV_PCI_CMPCIVAR_H_
40
41
42
43
44
45 struct cmpci_dmanode {
46 bus_dma_tag_t cd_tag;
47 int cd_nsegs;
48 bus_dma_segment_t cd_segs[1];
49 bus_dmamap_t cd_map;
50 caddr_t cd_addr;
51 size_t cd_size;
52 struct cmpci_dmanode *cd_next;
53 };
54
55 typedef struct cmpci_dmanode *cmpci_dmapool_t;
56 #define KVADDR(dma) ((void *)(dma)->cd_addr)
57 #define DMAADDR(dma) ((dma)->cd_map->dm_segs[0].ds_addr)
58
59
60
61
62
63
64
65
66 #define CMPCI_DAC_VOL 0
67 #define CMPCI_FM_VOL 1
68 #define CMPCI_CD_VOL 2
69 #define CMPCI_LINE_IN_VOL 3
70 #define CMPCI_AUX_IN_VOL 4
71 #define CMPCI_MIC_VOL 5
72
73 #define CMPCI_DAC_MUTE 6
74 #define CMPCI_FM_MUTE 7
75 #define CMPCI_CD_MUTE 8
76 #define CMPCI_LINE_IN_MUTE 9
77 #define CMPCI_AUX_IN_MUTE 10
78 #define CMPCI_MIC_MUTE 11
79
80 #define CMPCI_MIC_PREAMP 12
81 #define CMPCI_PCSPEAKER 13
82
83 #define CMPCI_RECORD_SOURCE 14
84 #define CMPCI_MIC_RECVOL 15
85
86 #define CMPCI_PLAYBACK_MODE 16
87 #define CMPCI_SPDIF_IN_SELECT 17
88 #define CMPCI_SPDIF_IN_PHASE 18
89 #define CMPCI_SPDIF_LOOP 19
90 #define CMPCI_SPDIF_OUT_PLAYBACK 20
91 #define CMPCI_SPDIF_OUT_VOLTAGE 21
92 #define CMPCI_MONITOR_DAC 22
93
94 #define CMPCI_MASTER_VOL 23
95 #define CMPCI_REAR 24
96 #define CMPCI_INDIVIDUAL 25
97 #define CMPCI_REVERSE 26
98 #define CMPCI_SURROUND 27
99
100 #define CMPCI_NDEVS 28
101
102 #define CMPCI_INPUT_CLASS 28
103 #define CMPCI_OUTPUT_CLASS 29
104 #define CMPCI_RECORD_CLASS 30
105 #define CMPCI_PLAYBACK_CLASS 31
106 #define CMPCI_SPDIF_CLASS 32
107
108 #define CmpciNspdif "spdif"
109 #define CmpciCspdif "spdif"
110 #define CmpciNspdin "spdin"
111 #define CmpciNspdin1 "spdin1"
112 #define CmpciNspdin2 "spdin2"
113 #define CmpciNspdout "spdout"
114 #define CmpciNplayback "playback"
115 #define CmpciCplayback "playback"
116 #define CmpciNlegacy "legacy"
117 #define CmpciNvoltage "voltage"
118 #define CmpciNphase "phase"
119 #define CmpciNpositive "positive"
120 #define CmpciNnegative "negative"
121 #define CmpciNrear "rear"
122 #define CmpciNindividual "individual"
123 #define CmpciNreverse "reverse"
124 #define CmpciNhigh_v "5V"
125 #define CmpciNlow_v "0.5V"
126 #define CmpciNsurround "surround"
127
128
129 #define CMPCI_RECORD_SOURCE_MIC CMPCI_SB16_MIXER_MIC_SRC
130 #define CMPCI_RECORD_SOURCE_CD CMPCI_SB16_MIXER_CD_SRC_R
131 #define CMPCI_RECORD_SOURCE_LINE_IN CMPCI_SB16_MIXER_LINE_SRC_R
132 #define CMPCI_RECORD_SOURCE_AUX_IN (1 << 8)
133 #define CMPCI_RECORD_SOURCE_WAVE (1 << 9)
134 #define CMPCI_RECORD_SOURCE_FM CMPCI_SB16_MIXER_FM_SRC_R
135 #define CMPCI_RECORD_SOURCE_SPDIF (1 << 10)
136
137
138 #define CMPCI_PLAYBACK_MODE_WAVE 0
139 #define CMPCI_PLAYBACK_MODE_SPDIF 1
140
141
142 #define CMPCI_SPDIFIN_SPDIFIN2 0x01
143 #define CMPCI_SPDIFIN_SPDIFOUT 0x02
144 #define CMPCI_SPDIF_IN_SPDIN1 0
145 #define CMPCI_SPDIF_IN_SPDIN2 CMPCI_SPDIFIN_SPDIFIN2
146 #define CMPCI_SPDIF_IN_SPDOUT (CMPCI_SPDIFIN_SPDIFIN2|CMPCI_SPDIFIN_SPDIFOUT)
147
148
149 #define CMPCI_SPDIF_IN_PHASE_POSITIVE 0
150 #define CMPCI_SPDIF_IN_PHASE_NEGATIVE 1
151
152
153 #define CMPCI_SPDIF_LOOP_OFF 0
154 #define CMPCI_SPDIF_LOOP_ON 1
155
156
157 #define CMPCI_SPDIF_OUT_PLAYBACK_WAVE 0
158 #define CMPCI_SPDIF_OUT_PLAYBACK_LEGACY 1
159
160
161 #define CMPCI_SPDIF_OUT_VOLTAGE_HIGH 0
162 #define CMPCI_SPDIF_OUT_VOLTAGE_LOW 1
163
164
165 #define CMPCI_MONDAC_ENABLE 0x01
166 #define CMPCI_MONDAC_SPDOUT 0x02
167 #define CMPCI_MONITOR_DAC_OFF 0
168 #define CMPCI_MONITOR_DAC_SPDIN CMPCI_MONDAC_ENABLE
169 #define CMPCI_MONITOR_DAC_SPDOUT (CMPCI_MONDAC_ENABLE | CMPCI_MONDAC_SPDOUT)
170
171
172
173
174
175 struct cmpci_softc {
176 struct device sc_dev;
177
178
179 uint32_t sc_id;
180 uint32_t sc_class;
181 uint32_t sc_capable;
182 #define CMPCI_CAP_SPDIN 0x00000001
183 #define CMPCI_CAP_SPDOUT 0x00000002
184 #define CMPCI_CAP_SPDLOOP 0x00000004
185 #define CMPCI_CAP_SPDLEGACY 0x00000008
186 #define CMPCI_CAP_SPDIN_MONITOR 0x00000010
187 #define CMPCI_CAP_XSPDOUT 0x00000020
188 #define CMPCI_CAP_SPDOUT_VOLTAGE 0x00000040
189 #define CMPCI_CAP_SPDOUT_48K 0x00000080
190 #define CMPCI_CAP_SURROUND 0x00000100
191 #define CMPCI_CAP_REAR 0x00000200
192 #define CMPCI_CAP_INDIVIDUAL_REAR 0x00000400
193 #define CMPCI_CAP_REVERSE_FR 0x00000800
194 #define CMPCI_CAP_SPDIN_PHASE 0x00001000
195 #define CMPCI_CAP_2ND_SPDIN 0x00002000
196
197 #define CMPCI_CAP_CMI8338 (CMPCI_CAP_SPDIN | CMPCI_CAP_SPDOUT | \
198 CMPCI_CAP_SPDLOOP | CMPCI_CAP_SPDLEGACY)
199
200 #define CMPCI_CAP_CMI8738 (CMPCI_CAP_CMI8338 | \
201 CMPCI_CAP_SPDIN_MONITOR | \
202 CMPCI_CAP_XSPDOUT | \
203 CMPCI_CAP_SPDOUT_VOLTAGE | \
204 CMPCI_CAP_SPDOUT_48K | CMPCI_CAP_SURROUND |\
205 CMPCI_CAP_REAR | \
206 CMPCI_CAP_INDIVIDUAL_REAR | \
207 CMPCI_CAP_REVERSE_FR | \
208 CMPCI_CAP_SPDIN_PHASE | \
209 CMPCI_CAP_2ND_SPDIN )
210 #define CMPCI_ISCAP(sc, name) (sc->sc_capable & CMPCI_CAP_ ## name)
211
212
213 bus_space_tag_t sc_iot;
214 bus_space_handle_t sc_ioh;
215
216 bus_space_handle_t sc_mpu_ioh;
217 struct device *sc_mpudev;
218
219
220 pci_intr_handle_t *sc_ih;
221
222
223 bus_dma_tag_t sc_dmat;
224 cmpci_dmapool_t sc_dmap;
225
226
227 struct {
228 void (*intr)(void *);
229 void *intr_arg;
230 int md_divide;
231 } sc_play, sc_rec;
232
233
234 uint32_t sc_reg_misc;
235
236
237 uint8_t sc_gain[CMPCI_NDEVS][2];
238 #define CMPCI_LEFT 0
239 #define CMPCI_RIGHT 1
240 #define CMPCI_LR 0
241 uint16_t sc_in_mask;
242 };
243
244
245 #endif
246
247