xref: /netbsd/sys/dev/pci/esovar.h (revision bf9ec67e)
1 /*	$NetBSD: esovar.h,v 1.4 2000/03/22 14:37:43 kleink Exp $	*/
2 
3 /*
4  * Copyright (c) 1999, 2000 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_RECORD_MONITOR	20
70 #define	ESO_MIC_PREAMP		21
71 #define	ESO_SPATIALIZER_ENABLE	22
72 #define	ESO_MASTER_MUTE		23
73 
74 /* Classes of the above */
75 #define	ESO_INPUT_CLASS		24
76 #define	ESO_OUTPUT_CLASS	25
77 #define	ESO_MICROPHONE_CLASS	26
78 #define	ESO_MONITOR_CLASS	27
79 #define	ESO_RECORD_CLASS	28
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 
90 	/* Optionally deferred configuration of Audio 1 DMAC I/O space */
91 	struct pci_attach_args	sc_pa;
92 	bus_size_t		sc_vcsize;	/* original size of mapping */
93 
94 	/* DMA */
95 	bus_dma_tag_t		sc_dmat;
96 	struct eso_dma *	sc_dmas;
97 
98 	/* I/O Base device */
99 	bus_space_tag_t		sc_iot;
100 	bus_space_handle_t	sc_ioh;
101 
102 	/* Audio/FM device */
103 	bus_space_tag_t		sc_sb_iot;
104 	bus_space_handle_t	sc_sb_ioh;
105 
106 	/* Audio 1 DMAC device */
107 	unsigned int		sc_dmac_configured;
108 	bus_space_tag_t		sc_dmac_iot;
109 	bus_space_handle_t	sc_dmac_ioh;
110 
111 	/* MPU-401 device */
112 	bus_space_tag_t		sc_mpu_iot;
113 	bus_space_handle_t	sc_mpu_ioh;
114 	struct device *		sc_mpudev;
115 
116 	/* Game device */
117 	bus_space_tag_t		sc_game_iot;
118 	bus_space_handle_t	sc_game_ioh;
119 
120 	/* MI audio interface: play/record interrupt callbacks and arguments */
121 	void			(*sc_pintr) __P((void *));
122 	void *			sc_parg;
123 	void			(*sc_rintr) __P((void *));
124 	void *			sc_rarg;
125 
126 	/* Auto-initialize DMA transfer block drain timeouts, in ticks */
127 	int			sc_pdrain;
128 	int			sc_rdrain;
129 
130 	/* Audio 2 state */
131 	uint8_t			sc_a2c2;	/* Audio 2 Control 2 */
132 
133 	/* Mixer state */
134 	uint8_t			sc_gain[ESO_NGAINDEVS][2];
135 #define	ESO_LEFT		0
136 #define	ESO_RIGHT		1
137 	unsigned int		sc_recsrc;	/* record source selection */
138 	unsigned int		sc_monooutsrc;	/* MONO_OUT source selection */
139 	unsigned int		sc_recmon;	/* record monitor setting */
140 	unsigned int		sc_preamp;	/* microphone preamp */
141 	unsigned int		sc_spatializer;	/* spatializer enable */
142 	unsigned int		sc_mvmute;	/* master volume mute */
143 };
144 
145 #endif /* !_DEV_PCI_ESOVAR_H_ */
146