xref: /openbsd/sys/dev/isa/essvar.h (revision fabcfecb)
1 /*	$OpenBSD: essvar.h,v 1.6 2024/10/22 21:50:02 jsg Exp $	*/
2 /*	$NetBSD: essvar.h,v 1.14 1999/03/18 06:03:31 mycroft Exp $	*/
3 /*
4  * Copyright 1997
5  * Digital Equipment Corporation. All rights reserved.
6  *
7  * This software is furnished under license and may be used and
8  * copied only in accordance with the following terms and conditions.
9  * Subject to these conditions, you may download, copy, install,
10  * use, modify and distribute this software in source and/or binary
11  * form. No title or ownership is transferred hereby.
12  *
13  * 1) Any source code used, modified or distributed must reproduce
14  *    and retain this copyright notice and list of conditions as
15  *    they appear in the source file.
16  *
17  * 2) No right is granted to use any trade name, trademark, or logo of
18  *    Digital Equipment Corporation. Neither the "Digital Equipment
19  *    Corporation" name nor any trademark or logo of Digital Equipment
20  *    Corporation may be used to endorse or promote products derived
21  *    from this software without the prior written permission of
22  *    Digital Equipment Corporation.
23  *
24  * 3) This software is provided "AS-IS" and any express or implied
25  *    warranties, including but not limited to, any implied warranties
26  *    of merchantability, fitness for a particular purpose, or
27  *    non-infringement are disclaimed. In no event shall DIGITAL be
28  *    liable for any damages whatsoever, and in particular, DIGITAL
29  *    shall not be liable for special, indirect, consequential, or
30  *    incidental damages or damages for lost profits, loss of
31  *    revenue or loss of use, whether such damages arise in contract,
32  *    negligence, tort, under statute, in equity, at law or otherwise,
33  *    even if advised of the possibility of such damage.
34  */
35 
36 /*
37 ** @(#) $RCSfile: essvar.h,v $ $Revision: 1.6 $ (SHARK) $Date: 2024/10/22 21:50:02 $
38 **
39 **++
40 **
41 **  essvar.h
42 **
43 **  FACILITY:
44 **
45 **	DIGITAL Network Appliance Reference Design (DNARD)
46 **
47 **  MODULE DESCRIPTION:
48 **
49 **	This module contains the structure definitions and function
50 **	prototypes for the ESS Technologies 1887/888 sound chip
51 **	driver.
52 **
53 **  AUTHORS:
54 **
55 **	Blair Fidler	Software Engineering Australia
56 **			Gold Coast, Australia.
57 **
58 **  CREATION DATE:
59 **
60 **	May 12, 1997.
61 **
62 **  MODIFICATION HISTORY:
63 **
64 **--
65 */
66 #define ESS_DAC_PLAY_VOL	0
67 #define ESS_MIC_PLAY_VOL	1
68 #define ESS_LINE_PLAY_VOL	2
69 #define ESS_SYNTH_PLAY_VOL	3
70 #define ESS_CD_PLAY_VOL		4
71 #define ESS_AUXB_PLAY_VOL	5
72 #define ESS_INPUT_CLASS		6
73 
74 #define ESS_MASTER_VOL		7
75 #define ESS_PCSPEAKER_VOL	8
76 #define ESS_OUTPUT_CLASS	9
77 
78 #define ESS_RECORD_MONITOR	10
79 #define ESS_MONITOR_CLASS	11
80 
81 #define ESS_RECORD_VOL		12
82 #define	ESS_RECORD_SOURCE	13
83 #define ESS_RECORD_CLASS	14
84 
85 #define ESS_1788_NDEVS		15
86 
87 #define ESS_DAC_REC_VOL		15
88 #define ESS_MIC_REC_VOL		16
89 #define ESS_LINE_REC_VOL	17
90 #define ESS_SYNTH_REC_VOL	18
91 #define ESS_CD_REC_VOL		19
92 #define ESS_AUXB_REC_VOL	20
93 #define ESS_MIC_PREAMP		21
94 
95 #define ESS_1888_NDEVS		22
96 #define ESS_MAX_NDEVS		22
97 
98 struct ess_audio_channel {
99 	int	drq;			/* DMA channel */
100 #define IS16BITDRQ(drq) ((drq) >= 4)
101 	int	irq;			/* IRQ line for this DMA channel */
102 	int	ist;
103 	void	*ih;			/* interrupt vectoring */
104 	u_long	nintr;			/* number of interrupts taken */
105 	void	(*intr)(void *);	/* ISR for DMA complete */
106 	void	*arg;			/* arg for intr() */
107 
108 	/* Status information */
109 	int	active;			/* boolean: channel in use? */
110 
111 	/* Polling state */
112 	int	polled;			/* 1 if channel is polled */
113 	int	dmapos;			/* last DMA pointer */
114 	int	buffersize;		/* size of DMA buffer */
115 	/* (The following is only needed due to the stupid block interface.) */
116 	int	dmacount;		/* leftover partial block */
117 	int	blksize;		/* current block size */
118 };
119 
120 struct ess_softc {
121 	struct	device sc_dev;		/* base device */
122 	struct	device *sc_isa;
123 	isa_chipset_tag_t sc_ic;
124 	bus_space_tag_t sc_iot;		/* tag */
125 	bus_space_handle_t sc_ioh;	/* handle */
126 	struct timeout sc_tmo1, sc_tmo2;
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(struct ess_softc *);
161 void	essattach(struct ess_softc *);
162 
163