xref: /openbsd/sys/dev/pci/esovar.h (revision 3d8817e4)
1 /*	$OpenBSD: esovar.h,v 1.6 2010/09/21 20:11:44 jakemsr Exp $	*/
2 /*	$NetBSD: esovar.h,v 1.5 2004/05/25 21:38:11 kleink Exp $	*/
3 
4 /*
5  * Copyright (c) 1999, 2000, 2004 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_MONOIN_BYPASS	20
71 #define	ESO_RECORD_MONITOR	21
72 #define	ESO_MIC_PREAMP		22
73 #define	ESO_SPATIALIZER_ENABLE	23
74 #define	ESO_MASTER_MUTE		24
75 
76 /* Classes of the above */
77 #define	ESO_INPUT_CLASS		25
78 #define	ESO_OUTPUT_CLASS	26
79 #define	ESO_MICROPHONE_CLASS	27
80 #define	ESO_MONITOR_CLASS	28
81 #define	ESO_RECORD_CLASS	29
82 #define	ESO_MONOIN_CLASS	30
83 
84 
85 /*
86  * Software state
87  */
88 struct eso_softc {
89 	struct device		sc_dev;
90 	pci_intr_handle_t *	sc_ih;
91 	unsigned int		sc_revision;	/* PCI Revision ID */
92 
93 	/* Optionally deferred configuration of Audio 1 DMAC I/O space */
94 	struct pci_attach_args	sc_pa;
95 	bus_size_t		sc_vcsize;	/* original size of mapping */
96 
97 	/* DMA */
98 	bus_dma_tag_t		sc_dmat;
99 	struct eso_dma *	sc_dmas;
100 
101 	/* I/O Base device */
102 	bus_space_tag_t		sc_iot;
103 	bus_space_handle_t	sc_ioh;
104 
105 	/* Audio/FM device */
106 	bus_space_tag_t		sc_sb_iot;
107 	bus_space_handle_t	sc_sb_ioh;
108 
109 	/* Audio 1 DMAC device */
110 	unsigned int		sc_dmac_configured;
111 	bus_addr_t		sc_dmac_addr;
112 	bus_space_tag_t		sc_dmac_iot;
113 	bus_space_handle_t	sc_dmac_ioh;
114 
115 	/* MPU-401 device */
116 	bus_space_tag_t		sc_mpu_iot;
117 	bus_space_handle_t	sc_mpu_ioh;
118 	struct device *		sc_mpudev;
119 
120 #if 0
121 	/* Game device */
122 	bus_space_tag_t		sc_game_iot;
123 	bus_space_handle_t	sc_game_ioh;
124 #endif
125 
126 	/* MI audio interface: play/record interrupt callbacks and arguments */
127 	void			(*sc_pintr)(void *);
128 	void *			sc_parg;
129 	void			(*sc_rintr)(void *);
130 	void *			sc_rarg;
131 
132 	/* Auto-initialize DMA transfer block drain timeouts, in ticks */
133 	int			sc_pdrain;
134 	int			sc_rdrain;
135 
136 	/* Audio 2 state */
137 	uint8_t			sc_a2c2;	/* Audio 2 Control 2 */
138 
139 	/* Mixer state */
140 	uint8_t			sc_gain[ESO_NGAINDEVS][2];
141 #define	ESO_LEFT		0
142 #define	ESO_RIGHT		1
143 	unsigned int		sc_recsrc;	/* record source selection */
144 	unsigned int		sc_monooutsrc;	/* MONO_OUT source selection */
145 	unsigned int		sc_monoinbypass;/* MONO_IN bypass enable */
146 	unsigned int		sc_recmon;	/* record monitor setting */
147 	unsigned int		sc_preamp;	/* microphone preamp */
148 	unsigned int		sc_spatializer;	/* spatializer enable */
149 	unsigned int		sc_mvmute;	/* master volume mute */
150 };
151 
152 #endif /* !_DEV_PCI_ESOVAR_H_ */
153