1 /* $NetBSD: interwavevar.h,v 1.14 2005/01/15 15:19:52 kent Exp $ */
2
3 /*
4 * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Author: Kari Mettinen
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the NetBSD
20 * Foundation, Inc. and its contributors.
21 * 4. Neither the name of The NetBSD Foundation nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 #ifndef INTERWAVEVAR_H
39 #define INTERWAVEVAR_H
40
41 typedef struct iw_voice_info {
42 u_char bank; /* lower 2 bits select one of 4 4M bank for voice data */
43 u_long start; /* voice data start address */
44 u_long end;
45 #define SACI_IRQ 0x80
46 #define SACI_BACKWARDS 0x40
47 #define SACI_IRQ_ENABLE 0x20
48 #define SACI_BOUNCE 0x10
49 #define SACI_LOOP 0x08
50 #define SACI_16BIT 0x04
51 #define SACI_STOP_1 0x02
52 #define SACI_STOP_0 0x01
53 u_char format; /* SACI , voice direction, format */
54 u_char volume;
55 #define SVCI_VOLUME_IRQ 0x80
56 #define SVCI_DIRECTION 0x40
57 #define SVCI_IRQ_ENABLE 0x20
58 #define SVCI_BOUNCE 0x10
59 #define SVCI_LOOP 0x08
60 #define SVCI_PCM 0x04 /* for playback continue over voice end */
61 #define SVCI_STOP_1 0x02
62 #define SVCI_STOP_0 0x01
63 u_char volume_control;
64 u_short left_offset; /* usually fully left */
65 u_short right_offset;
66 u_char effect_acc;
67 #define SMSI_ROM 0x80
68 #define SMSI_ULAW 0x40
69 #define SMSI_OFFSET_ON 0x20
70 #define SMSI_ALT_EFF 0x10
71 #define SMSI_OFF 0x02
72 #define SMSI_EFFECT 0x01
73 u_char mode;
74
75 } iw_voice_info_t;
76
77 typedef struct iw_port_info {
78 char off;
79 char pad[3];
80 int voll;
81 int volr;
82 } iw_port_info_t;
83
84 struct iw_softc {
85 struct device sc_dev;
86 bus_space_tag_t sc_iot; /* bus cookie */
87 isa_chipset_tag_t sc_ic;
88
89 int vers;
90 int revision;
91 int sc_fullduplex;
92 int sc_irate;
93 int sc_orate;
94 u_long sc_dma_flags;
95 int sc_irq;
96 int sc_midi_irq;
97
98 void (*sc_recintr)(void *);
99 void *sc_recarg;
100 void *sc_recdma_bp;
101 int sc_playdrq;
102 bus_size_t sc_play_maxsize;
103 int sc_recdrq;
104 bus_size_t sc_rec_maxsize;
105 int sc_recdma_cnt;
106 int sc_playing;
107 int sc_maxdma;
108
109 u_long outfifo;
110 u_long infifo;
111
112 int fifosize;
113 u_short silence;
114
115 u_long sc_last_dmasize;
116 u_long sc_last_playsize;
117 u_long sc_last_played;
118 u_long sc_play_pos; /* position of next free byte in buffer */
119 u_long sc_play_start; /* address of start of the buffer */
120 u_long sc_play_end; /* end */
121
122 void (*sc_playintr)(void *);
123 void *sc_playarg;
124 void *sc_playdma_bp;
125 int sc_playdma_cnt;
126
127 int play_encoding;
128 int play_channels;
129 int play_precision;
130 int sc_playlastcc;
131
132 int sc_fillcount;
133 int bytesout;
134 int bytesin;
135
136 int sc_playbuf_available;
137 int sc_recbuf_available;
138
139 int rec_encoding;
140 int rec_channels;
141 int rec_precision;
142 int sc_reclastcc;
143
144 u_char recfmtbits;
145 u_char playfmtbits;
146 u_char sc_recsrcbits;
147 int (*sc_ih)(void *);
148 iw_port_info_t sc_mic;
149 iw_port_info_t sc_aux1;
150 iw_port_info_t sc_aux2;
151 iw_port_info_t sc_linein;
152 iw_port_info_t sc_lineout;
153 iw_port_info_t sc_rec;
154 iw_port_info_t sc_dac;
155 iw_port_info_t sc_loopback;
156 iw_port_info_t sc_monoin;
157 volatile u_short flags; /* InterWave stat flags */
158
159 bus_space_handle_t dir_h; /* dummy handle for direct access*/
160 int codec_index; /* Base Port for Codec */
161 bus_space_handle_t codec_index_h;
162 isa_chipset_tag_t sc_codec_ic;
163 int pcdrar; /* Base Port for Ext Device */
164 int p2xr; /* Compatibility Base Port */
165 bus_space_handle_t p2xr_h;
166 isa_chipset_tag_t sc_p2xr_ic;
167 int p3xr; /* MIDI and Synth Base Port */
168 bus_space_handle_t p3xr_h;
169 isa_chipset_tag_t sc_p3xr_ic;
170 int p401ar; /* Gen Purpose Reg. 1 address */
171 int p201ar; /* Game Ctrl normally at 0x201 */
172 int pataar; /* Base Address for ATAPI I/O Space */
173
174 int p388ar; /* Base Port for AdLib. It should bbe 388h */
175 int pnprdp; /* PNP read data port */
176 int igidxr; /* Gen Index Reg at P3XR+0x03 */
177 int i16dp; /* 16-bit data port at P3XR+0x04 */
178 int i8dp; /* 8-bit data port at P3XR+0x05 */
179 int svsr; /* Synth Voice Select at P3XR+0x02 */
180 int cdatap; /* Codec Indexed Data Port at PCODAR+0x01 */
181 int csr1r; /* Codec Stat Reg 1 at PCODAR+0x02 */
182 int cxdr; /* Play or Record Data Reg at PCODAR+0x03 */
183 int gmxr; /* GMCR or GMSR at P3XR+0x00 */
184 int gmxdr; /* GMTDR or GMRDR at P3XR+0x01 */
185 int lmbdr; /* LMBDR at P3XR+0x07 */
186 u_char csn; /* Card Select Number */
187 u_char cmode; /* Codec Operation Mode */
188 int dma1_chan; /* DMA channel 1 (local DMA & codec rec) */
189 int dma2_chan; /* DMA channel 2 (codec play) */
190 int ext_chan; /* Ext Dev DMA channel */
191 u_char voices; /* Number of active voices */
192 u_long vendor; /* Vendor ID and Product Identifier */
193 long free_mem; /* Address of First Free LM Block */
194 long reserved_mem; /* Amount of LM reserved by app. */
195 u_char smode; /* Synth Mode */
196 long size_mem; /* Total LM in bytes */
197 struct cfdriver *iw_cd;
198 const struct audio_hw_if *iw_hw_if;
199 };
200
201 void iwattach(struct iw_softc *);
202
203 int iwopen(struct iw_softc *, int); /* open hardware */
204 void iwclose(void *); /* close hardware */
205
206 /* Encoding. */
207 /* XXX should we have separate in/out? */
208 int iw_query_encoding(void *, struct audio_encoding *);
209 int iw_set_params(void *, int, int, audio_params_t *, audio_params_t *,
210 stream_filter_list_t *, stream_filter_list_t *);
211
212 /* Hardware may have some say in the blocksize to choose */
213 int iw_round_blocksize(void *, int, int, const audio_params_t *);
214
215 int iw_commit_settings(void *);
216
217 /* Software en/decode functions, set if SW coding required by HW */
218 void iw_sw_encode(void *, int, u_char *, int);
219 void iw_sw_decode(void *, int, u_char *, int);
220
221 /* Start input/output routines. These usually control DMA. */
222 int iw_start_output(void *, void *, int, void (*)(void *), void *);
223 int iw_start_input(void *, void *, int, void (*)(void *), void *);
224
225 int iw_init_input(void *, void *, int);
226 int iw_init_output(void *, void *, int);
227 int iw_halt_output(void *);
228 int iw_halt_input(void *);
229
230 int iw_speaker_ctl(void *, int);
231 int iw_getdev(void *, struct audio_device *);
232 int iw_setfd(void *, int);
233
234 /* Mixer (in/out ports) */
235 int iw_set_port(void *, mixer_ctrl_t *);
236 int iw_get_port(void *, mixer_ctrl_t *);
237
238 int iw_query_devinfo(void *, mixer_devinfo_t *);
239
240 struct malloc_type;
241 void * iw_malloc(void *, int, size_t, struct malloc_type *, int);
242 void iw_free(void *,void *,struct malloc_type *);
243 size_t iw_round_buffersize(void *, int, size_t);
244 paddr_t iw_mappage(void *, void *, off_t, int);
245 int iw_get_props(void *);
246
247 #endif /* INTERWAVEVAR_H */
Cache object: 1434220b65e1b53e44a5349f0f765890
|