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