xref: /netbsd-src/sys/dev/isa/essvar.h (revision f22f501132a71dccf088665ce71b4812ecd6abd9)
1*f22f5011Snakayama /*	$NetBSD: essvar.h,v 1.27 2014/08/16 13:01:33 nakayama Exp $	*/
2080dc567Saugustss /*
3080dc567Saugustss  * Copyright 1997
4080dc567Saugustss  * Digital Equipment Corporation. All rights reserved.
5080dc567Saugustss  *
6080dc567Saugustss  * This software is furnished under license and may be used and
7080dc567Saugustss  * copied only in accordance with the following terms and conditions.
8080dc567Saugustss  * Subject to these conditions, you may download, copy, install,
9080dc567Saugustss  * use, modify and distribute this software in source and/or binary
10080dc567Saugustss  * form. No title or ownership is transferred hereby.
11080dc567Saugustss  *
12080dc567Saugustss  * 1) Any source code used, modified or distributed must reproduce
13080dc567Saugustss  *    and retain this copyright notice and list of conditions as
14080dc567Saugustss  *    they appear in the source file.
15080dc567Saugustss  *
16080dc567Saugustss  * 2) No right is granted to use any trade name, trademark, or logo of
17080dc567Saugustss  *    Digital Equipment Corporation. Neither the "Digital Equipment
18080dc567Saugustss  *    Corporation" name nor any trademark or logo of Digital Equipment
19080dc567Saugustss  *    Corporation may be used to endorse or promote products derived
20080dc567Saugustss  *    from this software without the prior written permission of
21080dc567Saugustss  *    Digital Equipment Corporation.
22080dc567Saugustss  *
23080dc567Saugustss  * 3) This software is provided "AS-IS" and any express or implied
24080dc567Saugustss  *    warranties, including but not limited to, any implied warranties
25080dc567Saugustss  *    of merchantability, fitness for a particular purpose, or
26080dc567Saugustss  *    non-infringement are disclaimed. In no event shall DIGITAL be
27080dc567Saugustss  *    liable for any damages whatsoever, and in particular, DIGITAL
28080dc567Saugustss  *    shall not be liable for special, indirect, consequential, or
29080dc567Saugustss  *    incidental damages or damages for lost profits, loss of
30080dc567Saugustss  *    revenue or loss of use, whether such damages arise in contract,
31080dc567Saugustss  *    negligence, tort, under statute, in equity, at law or otherwise,
32080dc567Saugustss  *    even if advised of the possibility of such damage.
33080dc567Saugustss  */
34080dc567Saugustss 
35080dc567Saugustss /*
36*f22f5011Snakayama ** @(#) $RCSfile: essvar.h,v $ $Revision: 1.27 $ (SHARK) $Date: 2014/08/16 13:01:33 $
37080dc567Saugustss **
38080dc567Saugustss **++
39080dc567Saugustss **
40080dc567Saugustss **  essvar.h
41080dc567Saugustss **
42080dc567Saugustss **  FACILITY:
43080dc567Saugustss **
44080dc567Saugustss **	DIGITAL Network Appliance Reference Design (DNARD)
45080dc567Saugustss **
46080dc567Saugustss **  MODULE DESCRIPTION:
47080dc567Saugustss **
48080dc567Saugustss **      This module contains the structure definitions and function
49080dc567Saugustss **      prototypes for the ESS Technologies 1887/888 sound chip
50080dc567Saugustss **      driver.
51080dc567Saugustss **
52080dc567Saugustss **  AUTHORS:
53080dc567Saugustss **
54080dc567Saugustss **	Blair Fidler	Software Engineering Australia
55080dc567Saugustss **			Gold Coast, Australia.
56080dc567Saugustss **
57080dc567Saugustss **  CREATION DATE:
58080dc567Saugustss **
59080dc567Saugustss **	May 12, 1997.
60080dc567Saugustss **
61080dc567Saugustss **  MODIFICATION HISTORY:
62080dc567Saugustss **
63080dc567Saugustss **--
64080dc567Saugustss */
65fc96443dSthorpej 
66fc96443dSthorpej #include <sys/callout.h>
67fc96443dSthorpej 
68080dc567Saugustss #define ESS_DAC_PLAY_VOL	0
69080dc567Saugustss #define ESS_MIC_PLAY_VOL	1
70080dc567Saugustss #define ESS_LINE_PLAY_VOL	2
71080dc567Saugustss #define ESS_SYNTH_PLAY_VOL	3
72080dc567Saugustss #define ESS_CD_PLAY_VOL		4
73080dc567Saugustss #define ESS_AUXB_PLAY_VOL	5
74080dc567Saugustss #define ESS_INPUT_CLASS		6
75080dc567Saugustss 
76080dc567Saugustss #define ESS_MASTER_VOL		7
77080dc567Saugustss #define ESS_PCSPEAKER_VOL	8
78080dc567Saugustss #define ESS_OUTPUT_CLASS	9
79080dc567Saugustss 
8064fffdfeSnathanw #define ESS_RECORD_MONITOR	10
8164fffdfeSnathanw #define ESS_MONITOR_CLASS	11
82080dc567Saugustss 
8364fffdfeSnathanw #define ESS_RECORD_VOL		12
8464fffdfeSnathanw #define	ESS_RECORD_SOURCE	13
8564fffdfeSnathanw #define ESS_RECORD_CLASS	14
86080dc567Saugustss 
8764fffdfeSnathanw #define ESS_1788_NDEVS		15
8864fffdfeSnathanw 
89*f22f5011Snakayama #define ESS_SPATIALIZER		15
90*f22f5011Snakayama #define ESS_SPATIALIZER_ENABLE	16
91*f22f5011Snakayama 
92*f22f5011Snakayama #define ESS_18X9_NDEVS		17
93*f22f5011Snakayama 
9464fffdfeSnathanw #define ESS_DAC_REC_VOL		15
9564fffdfeSnathanw #define ESS_MIC_REC_VOL		16
9664fffdfeSnathanw #define ESS_LINE_REC_VOL	17
9764fffdfeSnathanw #define ESS_SYNTH_REC_VOL	18
9864fffdfeSnathanw #define ESS_CD_REC_VOL		19
9964fffdfeSnathanw #define ESS_AUXB_REC_VOL	20
10064fffdfeSnathanw #define ESS_MIC_PREAMP		21
10164fffdfeSnathanw 
10264fffdfeSnathanw #define ESS_1888_NDEVS		22
10364fffdfeSnathanw #define ESS_MAX_NDEVS		22
104080dc567Saugustss 
105080dc567Saugustss struct ess_audio_channel
106080dc567Saugustss {
107080dc567Saugustss 	int	drq;			/* DMA channel */
10852a2804aSthorpej 	bus_size_t maxsize;		/* max size for DMA channel */
109f76fb482Saugustss #define IS16BITDRQ(drq) ((drq) >= 4)
110080dc567Saugustss 	int	irq;			/* IRQ line for this DMA channel */
111cdeb158dSaugustss 	int	ist;
112080dc567Saugustss 	void	*ih;			/* interrupt vectoring */
113080dc567Saugustss 	u_long	nintr;			/* number of interrupts taken */
114b85368e3Skent 	void	(*intr)(void*);		/* ISR for DMA complete */
115080dc567Saugustss 	void	*arg;			/* arg for intr() */
116080dc567Saugustss 
117080dc567Saugustss 	/* Status information */
118080dc567Saugustss 	int	active;			/* boolean: channel in use? */
11981d2718dSmycroft 
12081d2718dSmycroft 	/* Polling state */
12181d2718dSmycroft 	int	polled;			/* 1 if channel is polled */
12281d2718dSmycroft 	int	dmapos;			/* last DMA pointer */
12381d2718dSmycroft 	int	buffersize;		/* size of DMA buffer */
12481d2718dSmycroft 	/* (The following is only needed due to the stupid block interface.) */
12581d2718dSmycroft 	int	dmacount;		/* leftover partial block */
12681d2718dSmycroft 	int	blksize;		/* current block size */
127080dc567Saugustss };
128080dc567Saugustss 
129080dc567Saugustss struct ess_softc
130080dc567Saugustss {
1319cb526aaStsutsui 	device_t sc_dev;		/* base device */
132080dc567Saugustss 	isa_chipset_tag_t sc_ic;
133080dc567Saugustss 	bus_space_tag_t sc_iot;		/* tag */
134080dc567Saugustss 	bus_space_handle_t sc_ioh;	/* handle */
1358a962f23Sjmcneill 	kmutex_t sc_lock;
1368a962f23Sjmcneill 	kmutex_t sc_intr_lock;
137080dc567Saugustss 
1388a962f23Sjmcneill 	callout_t sc_poll1_ch;		/* audio1 poll */
1398a962f23Sjmcneill 	callout_t sc_poll2_ch;		/* audio2 poll */
140fc96443dSthorpej 
141080dc567Saugustss 	int	sc_iobase;		/* I/O port base address */
142080dc567Saugustss 
143080dc567Saugustss 	u_short	sc_open;		/* reference count of open calls */
144080dc567Saugustss 
14564fffdfeSnathanw 	int ndevs;
14664fffdfeSnathanw 	u_char	gain[ESS_MAX_NDEVS][2];	/* kept in input levels */
147080dc567Saugustss #define ESS_LEFT 0
148080dc567Saugustss #define ESS_RIGHT 1
149080dc567Saugustss 
150080dc567Saugustss 	u_int	out_port;		/* output port */
151080dc567Saugustss 	u_int	in_mask;		/* input ports */
152080dc567Saugustss 	u_int	in_port;		/* XXX needed for MI interface */
153080dc567Saugustss 
154080dc567Saugustss 	u_int	spkr_state;		/* non-null is on */
155080dc567Saugustss 
1563e404912Smycroft 	struct ess_audio_channel sc_audio1; /* audio channel for record */
1573e404912Smycroft 	struct ess_audio_channel sc_audio2; /* audio channel for playback */
158080dc567Saugustss 
159080dc567Saugustss 	u_int	sc_model;
160080dc567Saugustss #define ESS_UNSUPPORTED 0
161665e1f06Smycroft #define	ESS_688		1
162665e1f06Smycroft #define	ESS_1688	2
163665e1f06Smycroft #define ESS_1788	3
164665e1f06Smycroft #define ESS_1868	4
165665e1f06Smycroft #define ESS_1869	5
166665e1f06Smycroft #define ESS_1878	6
167665e1f06Smycroft #define ESS_1879	7
168665e1f06Smycroft #define ESS_888		8
169665e1f06Smycroft #define ESS_1887	9
170665e1f06Smycroft #define ESS_1888	10
171080dc567Saugustss 
172080dc567Saugustss 	u_int	sc_version;		/* Legacy ES688/ES1688 ID */
173955c2f90Sdrochner 
174*f22f5011Snakayama 	u_int	sc_spatializer;		/* spatializer enable */
175*f22f5011Snakayama 
176955c2f90Sdrochner 	/* game port on es1888 */
177955c2f90Sdrochner 	bus_space_tag_t sc_joy_iot;
178955c2f90Sdrochner 	bus_space_handle_t sc_joy_ioh;
179080dc567Saugustss };
180080dc567Saugustss 
181b85368e3Skent int	essmatch(struct ess_softc *);
182b85368e3Skent void	essattach(struct ess_softc *, int);
183b85368e3Skent int	ess_config_addr(struct ess_softc *);
184080dc567Saugustss 
185