summaryrefslogtreecommitdiff
path: root/sys/dev/isa/essvar.h
blob: cf1838a94d2ee2377598ccd2c5bc18f5b6012157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*	$OpenBSD: essvar.h,v 1.2 1999/09/30 22:13:52 kstailey Exp $	*/
/*	$NetBSD: essvar.h,v 1.14 1999/03/18 06:03:31 mycroft Exp $	*/
/*
 * Copyright 1997
 * Digital Equipment Corporation. All rights reserved.
 *
 * This software is furnished under license and may be used and
 * copied only in accordance with the following terms and conditions.
 * Subject to these conditions, you may download, copy, install,
 * use, modify and distribute this software in source and/or binary
 * form. No title or ownership is transferred hereby.
 *
 * 1) Any source code used, modified or distributed must reproduce
 *    and retain this copyright notice and list of conditions as
 *    they appear in the source file.
 *
 * 2) No right is granted to use any trade name, trademark, or logo of
 *    Digital Equipment Corporation. Neither the "Digital Equipment
 *    Corporation" name nor any trademark or logo of Digital Equipment
 *    Corporation may be used to endorse or promote products derived
 *    from this software without the prior written permission of
 *    Digital Equipment Corporation.
 *
 * 3) This software is provided "AS-IS" and any express or implied
 *    warranties, including but not limited to, any implied warranties
 *    of merchantability, fitness for a particular purpose, or
 *    non-infringement are disclaimed. In no event shall DIGITAL be
 *    liable for any damages whatsoever, and in particular, DIGITAL
 *    shall not be liable for special, indirect, consequential, or
 *    incidental damages or damages for lost profits, loss of
 *    revenue or loss of use, whether such damages arise in contract,
 *    negligence, tort, under statute, in equity, at law or otherwise,
 *    even if advised of the possibility of such damage.
 */

/*
** @(#) $RCSfile: essvar.h,v $ $Revision: 1.2 $ (SHARK) $Date: 1999/09/30 22:13:52 $
**
**++
**
**  essvar.h
**
**  FACILITY:
**
**	DIGITAL Network Appliance Reference Design (DNARD)
**
**  MODULE DESCRIPTION:
**
**      This module contains the structure definitions and function
**      prototypes for the ESS Technologies 1887/888 sound chip
**      driver.
**
**  AUTHORS:
**
**	Blair Fidler	Software Engineering Australia
**			Gold Coast, Australia.
**
**  CREATION DATE:  
**
**	May 12, 1997.
**
**  MODIFICATION HISTORY:
**
**--
*/
#define ESS_DAC_PLAY_VOL	0
#define ESS_MIC_PLAY_VOL	1
#define ESS_LINE_PLAY_VOL	2
#define ESS_SYNTH_PLAY_VOL	3
#define ESS_CD_PLAY_VOL		4
#define ESS_AUXB_PLAY_VOL	5
#define ESS_INPUT_CLASS		6

#define ESS_MASTER_VOL		7
#define ESS_PCSPEAKER_VOL	8
#define ESS_OUTPUT_CLASS	9

#define ESS_RECORD_MONITOR	10
#define ESS_MONITOR_CLASS	11

#define ESS_RECORD_VOL		12
#define	ESS_RECORD_SOURCE	13
#define ESS_RECORD_CLASS	14

#define ESS_1788_NDEVS		15

#define ESS_DAC_REC_VOL		15
#define ESS_MIC_REC_VOL		16
#define ESS_LINE_REC_VOL	17
#define ESS_SYNTH_REC_VOL	18
#define ESS_CD_REC_VOL		19
#define ESS_AUXB_REC_VOL	20
#define ESS_MIC_PREAMP		21

#define ESS_1888_NDEVS		22
#define ESS_MAX_NDEVS		22

struct ess_audio_channel
{
	int	drq;			/* DMA channel */
#define IS16BITDRQ(drq) ((drq) >= 4)
	int	irq;			/* IRQ line for this DMA channel */
	int	ist;
	void	*ih;			/* interrupt vectoring */
	u_long	nintr;			/* number of interrupts taken */
	void	(*intr)__P((void*));	/* ISR for DMA complete */
	void	*arg;			/* arg for intr() */

	/* Status information */
	int	active;			/* boolean: channel in use? */

	/* Polling state */
	int	polled;			/* 1 if channel is polled */
	int	dmapos;			/* last DMA pointer */
	int	buffersize;		/* size of DMA buffer */
	/* (The following is only needed due to the stupid block interface.) */
	int	dmacount;		/* leftover partial block */
	int	blksize;		/* current block size */
};

struct ess_softc
{
	struct	device sc_dev;		/* base device */
	struct	device *sc_isa;
	isa_chipset_tag_t sc_ic;
	bus_space_tag_t sc_iot;		/* tag */
	bus_space_handle_t sc_ioh;	/* handle */

	int	sc_iobase;		/* I/O port base address */

	u_short	sc_open;		/* reference count of open calls */

	int ndevs; 
	u_char	gain[ESS_MAX_NDEVS][2];	/* kept in input levels */
#define ESS_LEFT 0
#define ESS_RIGHT 1
	
	u_int	out_port;		/* output port */
	u_int	in_mask;		/* input ports */
	u_int	in_port;		/* XXX needed for MI interface */

	u_int	spkr_state;		/* non-null is on */
	
	struct ess_audio_channel sc_audio1; /* audio channel for record */
	struct ess_audio_channel sc_audio2; /* audio channel for playback */

	u_int	sc_model;
#define ESS_UNSUPPORTED 0
#define ESS_1888	1
#define ESS_1887	2
#define ESS_888		3
#define ESS_1788	4
#define ESS_1869	5
#define ESS_1879	6
#define ESS_1868	7
#define ESS_1878	8

	u_int	sc_version;		/* Legacy ES688/ES1688 ID */
};

int	essmatch __P((struct ess_softc *));
void	essattach __P((struct ess_softc *));