xref: /netbsd-src/sys/dev/isa/essvar.h (revision 89c5a767f8fc7a4633b2d409966e2becbb98ff92)
1 /*	$NetBSD: essvar.h,v 1.16 2000/02/07 22:07:31 thorpej Exp $	*/
2 /*
3  * Copyright 1997
4  * Digital Equipment Corporation. All rights reserved.
5  *
6  * This software is furnished under license and may be used and
7  * copied only in accordance with the following terms and conditions.
8  * Subject to these conditions, you may download, copy, install,
9  * use, modify and distribute this software in source and/or binary
10  * form. No title or ownership is transferred hereby.
11  *
12  * 1) Any source code used, modified or distributed must reproduce
13  *    and retain this copyright notice and list of conditions as
14  *    they appear in the source file.
15  *
16  * 2) No right is granted to use any trade name, trademark, or logo of
17  *    Digital Equipment Corporation. Neither the "Digital Equipment
18  *    Corporation" name nor any trademark or logo of Digital Equipment
19  *    Corporation may be used to endorse or promote products derived
20  *    from this software without the prior written permission of
21  *    Digital Equipment Corporation.
22  *
23  * 3) This software is provided "AS-IS" and any express or implied
24  *    warranties, including but not limited to, any implied warranties
25  *    of merchantability, fitness for a particular purpose, or
26  *    non-infringement are disclaimed. In no event shall DIGITAL be
27  *    liable for any damages whatsoever, and in particular, DIGITAL
28  *    shall not be liable for special, indirect, consequential, or
29  *    incidental damages or damages for lost profits, loss of
30  *    revenue or loss of use, whether such damages arise in contract,
31  *    negligence, tort, under statute, in equity, at law or otherwise,
32  *    even if advised of the possibility of such damage.
33  */
34 
35 /*
36 ** @(#) $RCSfile: essvar.h,v $ $Revision: 1.16 $ (SHARK) $Date: 2000/02/07 22:07:31 $
37 **
38 **++
39 **
40 **  essvar.h
41 **
42 **  FACILITY:
43 **
44 **	DIGITAL Network Appliance Reference Design (DNARD)
45 **
46 **  MODULE DESCRIPTION:
47 **
48 **      This module contains the structure definitions and function
49 **      prototypes for the ESS Technologies 1887/888 sound chip
50 **      driver.
51 **
52 **  AUTHORS:
53 **
54 **	Blair Fidler	Software Engineering Australia
55 **			Gold Coast, Australia.
56 **
57 **  CREATION DATE:
58 **
59 **	May 12, 1997.
60 **
61 **  MODIFICATION HISTORY:
62 **
63 **--
64 */
65 #define ESS_DAC_PLAY_VOL	0
66 #define ESS_MIC_PLAY_VOL	1
67 #define ESS_LINE_PLAY_VOL	2
68 #define ESS_SYNTH_PLAY_VOL	3
69 #define ESS_CD_PLAY_VOL		4
70 #define ESS_AUXB_PLAY_VOL	5
71 #define ESS_INPUT_CLASS		6
72 
73 #define ESS_MASTER_VOL		7
74 #define ESS_PCSPEAKER_VOL	8
75 #define ESS_OUTPUT_CLASS	9
76 
77 #define ESS_RECORD_MONITOR	10
78 #define ESS_MONITOR_CLASS	11
79 
80 #define ESS_RECORD_VOL		12
81 #define	ESS_RECORD_SOURCE	13
82 #define ESS_RECORD_CLASS	14
83 
84 #define ESS_1788_NDEVS		15
85 
86 #define ESS_DAC_REC_VOL		15
87 #define ESS_MIC_REC_VOL		16
88 #define ESS_LINE_REC_VOL	17
89 #define ESS_SYNTH_REC_VOL	18
90 #define ESS_CD_REC_VOL		19
91 #define ESS_AUXB_REC_VOL	20
92 #define ESS_MIC_PREAMP		21
93 
94 #define ESS_1888_NDEVS		22
95 #define ESS_MAX_NDEVS		22
96 
97 struct ess_audio_channel
98 {
99 	int	drq;			/* DMA channel */
100 	bus_size_t maxsize;		/* max size for DMA channel */
101 #define IS16BITDRQ(drq) ((drq) >= 4)
102 	int	irq;			/* IRQ line for this DMA channel */
103 	int	ist;
104 	void	*ih;			/* interrupt vectoring */
105 	u_long	nintr;			/* number of interrupts taken */
106 	void	(*intr)__P((void*));	/* ISR for DMA complete */
107 	void	*arg;			/* arg for intr() */
108 
109 	/* Status information */
110 	int	active;			/* boolean: channel in use? */
111 
112 	/* Polling state */
113 	int	polled;			/* 1 if channel is polled */
114 	int	dmapos;			/* last DMA pointer */
115 	int	buffersize;		/* size of DMA buffer */
116 	/* (The following is only needed due to the stupid block interface.) */
117 	int	dmacount;		/* leftover partial block */
118 	int	blksize;		/* current block size */
119 };
120 
121 struct ess_softc
122 {
123 	struct	device sc_dev;		/* base device */
124 	isa_chipset_tag_t sc_ic;
125 	bus_space_tag_t sc_iot;		/* tag */
126 	bus_space_handle_t sc_ioh;	/* handle */
127 
128 	int	sc_iobase;		/* I/O port base address */
129 
130 	u_short	sc_open;		/* reference count of open calls */
131 
132 	int ndevs;
133 	u_char	gain[ESS_MAX_NDEVS][2];	/* kept in input levels */
134 #define ESS_LEFT 0
135 #define ESS_RIGHT 1
136 
137 	u_int	out_port;		/* output port */
138 	u_int	in_mask;		/* input ports */
139 	u_int	in_port;		/* XXX needed for MI interface */
140 
141 	u_int	spkr_state;		/* non-null is on */
142 
143 	struct ess_audio_channel sc_audio1; /* audio channel for record */
144 	struct ess_audio_channel sc_audio2; /* audio channel for playback */
145 
146 	u_int	sc_model;
147 #define ESS_UNSUPPORTED 0
148 #define ESS_1888	1
149 #define ESS_1887	2
150 #define ESS_888		3
151 #define ESS_1788	4
152 #define ESS_1869	5
153 #define ESS_1879	6
154 #define ESS_1868	7
155 #define ESS_1878	8
156 
157 	u_int	sc_version;		/* Legacy ES688/ES1688 ID */
158 };
159 
160 int	essmatch __P((struct ess_softc *));
161 void	essattach __P((struct ess_softc *));
162 
163