xref: /netbsd-src/sys/dev/pci/esovar.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: esovar.h,v 1.9 2009/05/06 10:34:32 cegger 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  */
87 struct eso_softc {
88 	struct device		sc_dev;
89 	pci_intr_handle_t *	sc_ih;
90 	unsigned int		sc_revision;	/* PCI Revision ID */
91 
92 	/* Optionally deferred configuration of Audio 1 DMAC I/O space */
93 	struct pci_attach_args	sc_pa;
94 	bus_size_t		sc_vcsize;	/* original size of mapping */
95 
96 	/* DMA */
97 	bus_dma_tag_t		sc_dmat;
98 	SLIST_HEAD(, eso_dma)	sc_dmas;
99 
100 	/* I/O Base device */
101 	bus_space_tag_t		sc_iot;
102 	bus_space_handle_t	sc_ioh;
103 
104 	/* Audio/FM device */
105 	bus_space_tag_t		sc_sb_iot;
106 	bus_space_handle_t	sc_sb_ioh;
107 
108 	/* Audio 1 DMAC device */
109 	unsigned int		sc_dmac_configured;
110 	bus_space_tag_t		sc_dmac_iot;
111 	bus_space_handle_t	sc_dmac_ioh;
112 
113 	/* MPU-401 device */
114 	bus_space_tag_t		sc_mpu_iot;
115 	bus_space_handle_t	sc_mpu_ioh;
116 	device_t 		sc_mpudev;
117 
118 	/* Game device */
119 	bus_space_tag_t		sc_game_iot;
120 	bus_space_handle_t	sc_game_ioh;
121 
122 	/* MI audio interface: play/record interrupt callbacks and arguments */
123 	void			(*sc_pintr)(void *);
124 	void *			sc_parg;
125 	void			(*sc_rintr)(void *);
126 	void *			sc_rarg;
127 
128 	/* Auto-initialize DMA transfer block drain timeouts, in ticks */
129 	int			sc_pdrain;
130 	int			sc_rdrain;
131 
132 	/* Audio 2 state */
133 	uint8_t			sc_a2c2;	/* Audio 2 Control 2 */
134 
135 	/* Mixer state */
136 	uint8_t			sc_gain[ESO_NGAINDEVS][2];
137 #define	ESO_LEFT		0
138 #define	ESO_RIGHT		1
139 	unsigned int		sc_recsrc;	/* record source selection */
140 	unsigned int		sc_monooutsrc;	/* MONO_OUT source selection */
141 	unsigned int		sc_monoinbypass;/* MONO_IN bypass enable */
142 	unsigned int		sc_recmon;	/* record monitor setting */
143 	unsigned int		sc_preamp;	/* microphone preamp */
144 	unsigned int		sc_spatializer;	/* spatializer enable */
145 	unsigned int		sc_mvmute;	/* master volume mute */
146 };
147 
148 #endif /* !_DEV_PCI_ESOVAR_H_ */
149