cmpcivar.h revision 1.1.6.3 1 1.1.6.3 bouyer /* $NetBSD: cmpcivar.h,v 1.1.6.3 2001/03/12 13:31:05 bouyer Exp $ */
2 1.1.6.2 bouyer
3 1.1.6.2 bouyer /*
4 1.1.6.2 bouyer * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 1.1.6.2 bouyer * All rights reserved.
6 1.1.6.2 bouyer *
7 1.1.6.2 bouyer * This code is derived from software contributed to The NetBSD Foundation
8 1.1.6.3 bouyer * by Takuya SHIOZAKI <tshiozak (at) netbsd.org> .
9 1.1.6.2 bouyer *
10 1.1.6.2 bouyer * Redistribution and use in source and binary forms, with or without
11 1.1.6.2 bouyer * modification, are permitted provided that the following conditions
12 1.1.6.2 bouyer * are met:
13 1.1.6.2 bouyer * 1. Redistributions of source code must retain the above copyright
14 1.1.6.2 bouyer * notice, this list of conditions and the following disclaimer.
15 1.1.6.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
16 1.1.6.2 bouyer * notice, this list of conditions and the following disclaimer in the
17 1.1.6.2 bouyer * documentation and/or other materials provided with the distribution.
18 1.1.6.2 bouyer *
19 1.1.6.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 1.1.6.2 bouyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1.6.2 bouyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1.6.2 bouyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 1.1.6.2 bouyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1.6.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1.6.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1.6.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1.6.2 bouyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1.6.2 bouyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1.6.2 bouyer * SUCH DAMAGE.
30 1.1.6.2 bouyer *
31 1.1.6.2 bouyer */
32 1.1.6.2 bouyer
33 1.1.6.2 bouyer /* C-Media CMI8x38 Audio Chip Support */
34 1.1.6.2 bouyer
35 1.1.6.2 bouyer #ifndef _DEV_PCI_CMPCIVAR_H_
36 1.1.6.2 bouyer #define _DEV_PCI_CMPCIVAR_H_ (1)
37 1.1.6.2 bouyer
38 1.1.6.2 bouyer
39 1.1.6.2 bouyer /*
40 1.1.6.2 bouyer * DMA pool
41 1.1.6.2 bouyer */
42 1.1.6.2 bouyer struct cmpci_dmanode {
43 1.1.6.3 bouyer bus_dma_tag_t cd_tag;
44 1.1.6.3 bouyer int cd_nsegs;
45 1.1.6.3 bouyer bus_dma_segment_t cd_segs[1];
46 1.1.6.3 bouyer bus_dmamap_t cd_map;
47 1.1.6.3 bouyer caddr_t cd_addr;
48 1.1.6.3 bouyer size_t cd_size;
49 1.1.6.3 bouyer struct cmpci_dmanode *cd_next;
50 1.1.6.2 bouyer };
51 1.1.6.2 bouyer
52 1.1.6.2 bouyer typedef struct cmpci_dmanode *cmpci_dmapool_t;
53 1.1.6.2 bouyer #define KVADDR(dma) ((void *)(dma)->cd_addr)
54 1.1.6.2 bouyer #define DMAADDR(dma) ((dma)->cd_map->dm_segs[0].ds_addr)
55 1.1.6.2 bouyer
56 1.1.6.2 bouyer
57 1.1.6.2 bouyer /*
58 1.1.6.2 bouyer * Mixer - SoundBraster16 Compatible
59 1.1.6.2 bouyer */
60 1.1.6.2 bouyer #define CMPCI_MASTER_VOL 0
61 1.1.6.2 bouyer #define CMPCI_FM_VOL 1
62 1.1.6.2 bouyer #define CMPCI_CD_VOL 2
63 1.1.6.2 bouyer #define CMPCI_VOICE_VOL 3
64 1.1.6.2 bouyer #define CMPCI_OUTPUT_CLASS 4
65 1.1.6.2 bouyer
66 1.1.6.2 bouyer #define CMPCI_MIC_VOL 5
67 1.1.6.2 bouyer #define CMPCI_LINE_IN_VOL 6
68 1.1.6.2 bouyer #define CMPCI_RECORD_SOURCE 7
69 1.1.6.2 bouyer #define CMPCI_TREBLE 8
70 1.1.6.2 bouyer #define CMPCI_BASS 9
71 1.1.6.2 bouyer #define CMPCI_RECORD_CLASS 10
72 1.1.6.2 bouyer #define CMPCI_INPUT_CLASS 11
73 1.1.6.2 bouyer
74 1.1.6.2 bouyer #define CMPCI_PCSPEAKER 12
75 1.1.6.2 bouyer #define CMPCI_INPUT_GAIN 13
76 1.1.6.2 bouyer #define CMPCI_OUTPUT_GAIN 14
77 1.1.6.2 bouyer #define CMPCI_AGC 15
78 1.1.6.2 bouyer #define CMPCI_EQUALIZATION_CLASS 16
79 1.1.6.2 bouyer
80 1.1.6.2 bouyer #define CMPCI_CD_IN_MUTE 17
81 1.1.6.2 bouyer #define CMPCI_MIC_IN_MUTE 18
82 1.1.6.2 bouyer #define CMPCI_LINE_IN_MUTE 19
83 1.1.6.2 bouyer #define CMPCI_FM_IN_MUTE 20
84 1.1.6.2 bouyer
85 1.1.6.2 bouyer #define CMPCI_CD_SWAP 21
86 1.1.6.2 bouyer #define CMPCI_MIC_SWAP 22
87 1.1.6.2 bouyer #define CMPCI_LINE_SWAP 23
88 1.1.6.2 bouyer #define CMPCI_FM_SWAP 24
89 1.1.6.2 bouyer
90 1.1.6.2 bouyer #define CMPCI_CD_OUT_MUTE 25
91 1.1.6.2 bouyer #define CMPCI_MIC_OUT_MUTE 26
92 1.1.6.2 bouyer #define CMPCI_LINE_OUT_MUTE 27
93 1.1.6.2 bouyer
94 1.1.6.3 bouyer #define CMPCI_SPDIF_IN_MUTE 28
95 1.1.6.3 bouyer #define CMPCI_SPDIF_CLASS 29
96 1.1.6.3 bouyer #define CMPCI_SPDIF_LOOP 30
97 1.1.6.3 bouyer #define CMPCI_SPDIF_LEGACY 31
98 1.1.6.3 bouyer #define CMPCI_SPDIF_OUT_VOLTAGE 32
99 1.1.6.3 bouyer #define CMPCI_SPDIF_IN_PHASE 33
100 1.1.6.3 bouyer #define CMPCI_REAR 34
101 1.1.6.3 bouyer #define CMPCI_INDIVIDUAL 35
102 1.1.6.3 bouyer #define CMPCI_REVERSE 36
103 1.1.6.3 bouyer #define CMPCI_SURROUND 37
104 1.1.6.2 bouyer #define CmpciNspdif "spdif"
105 1.1.6.3 bouyer #define CmpciCspdif "spdif"
106 1.1.6.3 bouyer #define CmpciNloop "loop"
107 1.1.6.3 bouyer #define CmpciNlegacy "legacy"
108 1.1.6.3 bouyer #define CmpciNout_voltage "out_voltage"
109 1.1.6.3 bouyer #define CmpciNin_phase "in_phase"
110 1.1.6.3 bouyer #define CmpciNpositive "positive"
111 1.1.6.3 bouyer #define CmpciNnegative "negative"
112 1.1.6.3 bouyer #define CmpciNrear "rear"
113 1.1.6.3 bouyer #define CmpciNindividual "individual"
114 1.1.6.3 bouyer #define CmpciNreverse "reverse"
115 1.1.6.3 bouyer #define CmpciNlow_v "0.5V"
116 1.1.6.3 bouyer #define CmpciNhigh_v "5V"
117 1.1.6.3 bouyer #define CmpciNsurround "surround"
118 1.1.6.3 bouyer #define CMPCI_NDEVS 38
119 1.1.6.2 bouyer
120 1.1.6.2 bouyer #define CMPCI_IS_IN_MUTE(x) ((x) < CMPCI_CD_SWAP)
121 1.1.6.2 bouyer
122 1.1.6.2 bouyer
123 1.1.6.2 bouyer /*
124 1.1.6.2 bouyer * softc
125 1.1.6.2 bouyer */
126 1.1.6.2 bouyer struct cmpci_softc {
127 1.1.6.3 bouyer struct device sc_dev;
128 1.1.6.2 bouyer
129 1.1.6.2 bouyer /* model/rev */
130 1.1.6.3 bouyer uint32_t sc_id;
131 1.1.6.3 bouyer uint32_t sc_class;
132 1.1.6.3 bouyer uint32_t sc_capable;
133 1.1.6.3 bouyer #define CMPCI_CAP_SPDIN 0x00000001
134 1.1.6.3 bouyer #define CMPCI_CAP_SPDOUT 0x00000002
135 1.1.6.3 bouyer #define CMPCI_CAP_SPDLOOP 0x00000004
136 1.1.6.3 bouyer #define CMPCI_CAP_SPDLEGACY 0x00000008
137 1.1.6.3 bouyer #define CMPCI_CAP_SPDIN_MONITOR 0x00000010
138 1.1.6.3 bouyer #define CMPCI_CAP_XSPDOUT 0x00000020
139 1.1.6.3 bouyer #define CMPCI_CAP_SPDOUT_VOLTAGE 0x00000040
140 1.1.6.3 bouyer #define CMPCI_CAP_SPDOUT_48K 0x00000080
141 1.1.6.3 bouyer #define CMPCI_CAP_SURROUND 0x00000100
142 1.1.6.3 bouyer #define CMPCI_CAP_REAR 0x00000200
143 1.1.6.3 bouyer #define CMPCI_CAP_INDIVIDUAL_REAR 0x00000400
144 1.1.6.3 bouyer #define CMPCI_CAP_REVERSE_FR 0x00000800
145 1.1.6.3 bouyer #define CMPCI_CAP_SPDIN_PHASE 0x00001000
146 1.1.6.3 bouyer
147 1.1.6.3 bouyer #define CMPCI_CAP_CMI8338 (CMPCI_CAP_SPDIN | CMPCI_CAP_SPDOUT | \
148 1.1.6.3 bouyer CMPCI_CAP_SPDLOOP | CMPCI_CAP_SPDLEGACY)
149 1.1.6.3 bouyer
150 1.1.6.3 bouyer #define CMPCI_CAP_CMI8738 (CMPCI_CAP_CMI8338 | \
151 1.1.6.3 bouyer CMPCI_CAP_SPDIN_MONITOR | \
152 1.1.6.3 bouyer CMPCI_CAP_XSPDOUT | \
153 1.1.6.3 bouyer CMPCI_CAP_SPDOUT_VOLTAGE | \
154 1.1.6.3 bouyer CMPCI_CAP_SPDOUT_48K | CMPCI_CAP_SURROUND |\
155 1.1.6.3 bouyer CMPCI_CAP_REAR | \
156 1.1.6.3 bouyer CMPCI_CAP_INDIVIDUAL_REAR | \
157 1.1.6.3 bouyer CMPCI_CAP_REVERSE_FR | \
158 1.1.6.3 bouyer CMPCI_CAP_SPDIN_PHASE)
159 1.1.6.3 bouyer #define CMPCI_ISCAP(sc, name) (sc->sc_capable & CMPCI_CAP_ ## name)
160 1.1.6.2 bouyer
161 1.1.6.2 bouyer /* I/O Base device */
162 1.1.6.3 bouyer bus_space_tag_t sc_iot;
163 1.1.6.3 bouyer bus_space_handle_t sc_ioh;
164 1.1.6.2 bouyer
165 1.1.6.2 bouyer /* intr handle */
166 1.1.6.3 bouyer pci_intr_handle_t *sc_ih;
167 1.1.6.2 bouyer
168 1.1.6.2 bouyer /* DMA */
169 1.1.6.3 bouyer bus_dma_tag_t sc_dmat;
170 1.1.6.3 bouyer cmpci_dmapool_t sc_dmap;
171 1.1.6.2 bouyer
172 1.1.6.2 bouyer /* each channel */
173 1.1.6.2 bouyer struct {
174 1.1.6.3 bouyer void (*intr) __P((void *));
175 1.1.6.3 bouyer void *intr_arg;
176 1.1.6.3 bouyer int md_divide;
177 1.1.6.2 bouyer } sc_play, sc_rec;
178 1.1.6.2 bouyer
179 1.1.6.2 bouyer /* mixer */
180 1.1.6.3 bouyer uint8_t sc_gain[CMPCI_NDEVS][2];
181 1.1.6.3 bouyer #define CMPCI_LEFT 0
182 1.1.6.3 bouyer #define CMPCI_RIGHT 1
183 1.1.6.3 bouyer #define CMPCI_LR 0
184 1.1.6.3 bouyer uint16_t sc_in_mask;
185 1.1.6.2 bouyer };
186 1.1.6.2 bouyer
187 1.1.6.2 bouyer
188 1.1.6.2 bouyer #endif /* _DEV_PCI_CMPCIVAR_H_ */
189 1.1.6.2 bouyer
190 1.1.6.2 bouyer /* end of file */
191