1 /* $OpenBSD: esovar.h,v 1.3 2002/06/09 02:31:20 mickey Exp $ */
2 /* $NetBSD: esovar.h,v 1.2 1999/08/02 17:37:43 augustss Exp $ */
3
4 /*
5 * Copyright (c) 1999 Klaus J. Klein
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * 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 #ifndef _DEV_PCI_ESOVAR_H_
33 #define _DEV_PCI_ESOVAR_H_
34
35 /*
36 * Definitions exported for the purpose of sharing with attached
37 * device drivers.
38 */
39
40 /*
41 * Mixer identifiers
42 */
43 /* Identifiers that have a gain value associated with them */
44 #define ESO_DAC_PLAY_VOL 0
45 #define ESO_MIC_PLAY_VOL 1
46 #define ESO_LINE_PLAY_VOL 2
47 #define ESO_SYNTH_PLAY_VOL 3
48 #define ESO_MONO_PLAY_VOL 4
49 #define ESO_CD_PLAY_VOL 5 /* AuxA */
50 #define ESO_AUXB_PLAY_VOL 6
51
52 #define ESO_MASTER_VOL 7
53 #define ESO_PCSPEAKER_VOL 8
54 #define ESO_SPATIALIZER 9
55
56 #define ESO_RECORD_VOL 10
57 #define ESO_DAC_REC_VOL 11
58 #define ESO_MIC_REC_VOL 12
59 #define ESO_LINE_REC_VOL 13
60 #define ESO_SYNTH_REC_VOL 14
61 #define ESO_MONO_REC_VOL 15
62 #define ESO_CD_REC_VOL 16
63 #define ESO_AUXB_REC_VOL 17
64 /* Used to keep software state */
65 #define ESO_NGAINDEVS (ESO_AUXB_REC_VOL + 1)
66
67 /* Other, non-gain related mixer identifiers */
68 #define ESO_RECORD_SOURCE 18
69 #define ESO_MONOOUT_SOURCE 19
70 #define ESO_RECORD_MONITOR 20
71 #define ESO_MIC_PREAMP 21
72 #define ESO_SPATIALIZER_ENABLE 22
73
74 /* Classes of the above */
75 #define ESO_INPUT_CLASS 23
76 #define ESO_OUTPUT_CLASS 24
77 #define ESO_MICROPHONE_CLASS 25
78 #define ESO_MONITOR_CLASS 26
79 #define ESO_RECORD_CLASS 27
80
81
82 /*
83 * Software state
84 */
85 struct eso_softc {
86 struct device sc_dev;
87 pci_intr_handle_t * sc_ih;
88 unsigned int sc_revision; /* PCI Revision ID */
89 void * sc_powerhook;
90
91 /* Optionally deferred configuration of Audio 1 DMAC I/O space */
92 struct pci_attach_args sc_pa;
93 bus_size_t sc_vcsize; /* original size of mapping */
94
95 /* DMA */
96 bus_dma_tag_t sc_dmat;
97 struct eso_dma * sc_dmas;
98
99 /* I/O Base device */
100 bus_space_tag_t sc_iot;
101 bus_space_handle_t sc_ioh;
102
103 /* Audio/FM device */
104 bus_space_tag_t sc_sb_iot;
105 bus_space_handle_t sc_sb_ioh;
106
107 /* Audio 1 DMAC device */
108 unsigned int sc_dmac_configured;
109 bus_space_tag_t sc_dmac_iot;
110 bus_space_handle_t sc_dmac_ioh;
111
112 /* MPU-401 device */
113 bus_space_tag_t sc_mpu_iot;
114 bus_space_handle_t sc_mpu_ioh;
115 struct device *sc_mpudev;
116
117 /* Game device */
118 bus_space_tag_t sc_game_iot;
119 bus_space_handle_t sc_game_ioh;
120
121 /* MI audio interface: play/record interrupt callbacks and arguments */
122 void (*sc_pintr)(void *);
123 void * sc_parg;
124 void (*sc_rintr)(void *);
125 void * sc_rarg;
126
127 /* Audio 2 state */
128 uint8_t sc_a2c2; /* Audio 2 Control 2 */
129
130 /* Mixer state */
131 uint8_t sc_gain[ESO_NGAINDEVS][2];
132 #define ESO_LEFT 0
133 #define ESO_RIGHT 1
134 unsigned int sc_recsrc; /* record source selection */
135 unsigned int sc_monooutsrc; /* MONO_OUT source selection */
136 unsigned int sc_recmon; /* record monitor setting */
137 unsigned int sc_preamp; /* microphone preamp */
138 unsigned int sc_spatializer; /* spatializer enable */
139 };
140
141 #endif /* !_DEV_PCI_ESOVAR_H_ */