cmpcivar.h revision 1.1.6.2 1 /* $NetBSD: cmpcivar.h,v 1.1.6.2 2000/11/20 11:42:15 bouyer Exp $ */
2
3 /*
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Takuya SHIOZAKI <AoiMoe (at) imou.to> .
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 */
32
33 /* C-Media CMI8x38 Audio Chip Support */
34
35 #ifndef _DEV_PCI_CMPCIVAR_H_
36 #define _DEV_PCI_CMPCIVAR_H_ (1)
37
38
39 /*
40 * DMA pool
41 */
42 struct cmpci_dmanode {
43 bus_dma_tag_t cd_tag;
44 int cd_nsegs;
45 bus_dma_segment_t cd_segs[1];
46 bus_dmamap_t cd_map;
47 caddr_t cd_addr;
48 size_t cd_size;
49 struct cmpci_dmanode *cd_next;
50 };
51
52 typedef struct cmpci_dmanode *cmpci_dmapool_t;
53 #define KVADDR(dma) ((void *)(dma)->cd_addr)
54 #define DMAADDR(dma) ((dma)->cd_map->dm_segs[0].ds_addr)
55
56
57 /*
58 * Mixer - SoundBraster16 Compatible
59 */
60 #define CMPCI_MASTER_VOL 0
61 #define CMPCI_FM_VOL 1
62 #define CMPCI_CD_VOL 2
63 #define CMPCI_VOICE_VOL 3
64 #define CMPCI_OUTPUT_CLASS 4
65
66 #define CMPCI_MIC_VOL 5
67 #define CMPCI_LINE_IN_VOL 6
68 #define CMPCI_RECORD_SOURCE 7
69 #define CMPCI_TREBLE 8
70 #define CMPCI_BASS 9
71 #define CMPCI_RECORD_CLASS 10
72 #define CMPCI_INPUT_CLASS 11
73
74 #define CMPCI_PCSPEAKER 12
75 #define CMPCI_INPUT_GAIN 13
76 #define CMPCI_OUTPUT_GAIN 14
77 #define CMPCI_AGC 15
78 #define CMPCI_EQUALIZATION_CLASS 16
79
80 #define CMPCI_CD_IN_MUTE 17
81 #define CMPCI_MIC_IN_MUTE 18
82 #define CMPCI_LINE_IN_MUTE 19
83 #define CMPCI_FM_IN_MUTE 20
84
85 #define CMPCI_CD_SWAP 21
86 #define CMPCI_MIC_SWAP 22
87 #define CMPCI_LINE_SWAP 23
88 #define CMPCI_FM_SWAP 24
89
90 #define CMPCI_CD_OUT_MUTE 25
91 #define CMPCI_MIC_OUT_MUTE 26
92 #define CMPCI_LINE_OUT_MUTE 27
93
94 #ifdef CMPCI_SPDIF_SUPPORT
95 #define CMPCI_SPDIF_IN 28
96 #define CMPCI_SPDIF_IN_MUTE 29
97 #define CmpciNspdif "spdif"
98 #define CMPCI_NDEVS 30
99 #else
100 #define CMPCI_NDEVS 28
101 #endif
102
103 #define CMPCI_IS_IN_MUTE(x) ((x) < CMPCI_CD_SWAP)
104
105
106 /*
107 * softc
108 */
109 struct cmpci_softc {
110 struct device sc_dev;
111
112 /* model/rev */
113 int sc_revision;
114 int sc_model;
115
116 /* I/O Base device */
117 bus_space_tag_t sc_iot;
118 bus_space_handle_t sc_ioh;
119
120 /* intr handle */
121 pci_intr_handle_t * sc_ih;
122
123 /* DMA */
124 bus_dma_tag_t sc_dmat;
125 cmpci_dmapool_t sc_dmap;
126
127 /* each channel */
128 struct {
129 void (*intr) __P((void *));
130 void *intr_arg;
131 } sc_play, sc_rec;
132
133 /* mixer */
134 uint8_t gain[CMPCI_NDEVS][2];
135 #define CMPCI_LEFT 0
136 #define CMPCI_RIGHT 1
137 #define CMPCI_LR 0
138 uint16_t in_mask;
139 };
140
141
142 #endif /* _DEV_PCI_CMPCIVAR_H_ */
143
144 /* end of file */
145