1 /* $NetBSD: interwavevar.h,v 1.15 2005/12/11 12:21:27 christos Exp $ */
4 * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
7 * Author: Kari Mettinen
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef INTERWAVEVAR_H
32 #define INTERWAVEVAR_H
34 typedef struct iw_voice_info
{
35 u_char bank
; /* lower 2 bits select one of 4 4M bank for voice data */
36 u_long start
; /* voice data start address */
39 #define SACI_BACKWARDS 0x40
40 #define SACI_IRQ_ENABLE 0x20
41 #define SACI_BOUNCE 0x10
42 #define SACI_LOOP 0x08
43 #define SACI_16BIT 0x04
44 #define SACI_STOP_1 0x02
45 #define SACI_STOP_0 0x01
46 u_char format
; /* SACI , voice direction, format */
48 #define SVCI_VOLUME_IRQ 0x80
49 #define SVCI_DIRECTION 0x40
50 #define SVCI_IRQ_ENABLE 0x20
51 #define SVCI_BOUNCE 0x10
52 #define SVCI_LOOP 0x08
53 #define SVCI_PCM 0x04 /* for playback continue over voice end */
54 #define SVCI_STOP_1 0x02
55 #define SVCI_STOP_0 0x01
56 u_char volume_control
;
57 u_short left_offset
; /* usually fully left */
61 #define SMSI_ULAW 0x40
62 #define SMSI_OFFSET_ON 0x20
63 #define SMSI_ALT_EFF 0x10
65 #define SMSI_EFFECT 0x01
70 typedef struct iw_port_info
{
79 bus_space_tag_t sc_iot
; /* bus cookie */
80 isa_chipset_tag_t sc_ic
;
91 void (*sc_recintr
)(void *);
95 bus_size_t sc_play_maxsize
;
97 bus_size_t sc_rec_maxsize
;
108 u_long sc_last_dmasize
;
109 u_long sc_last_playsize
;
110 u_long sc_last_played
;
111 u_long sc_play_pos
; /* position of next free byte in buffer */
112 u_long sc_play_start
; /* address of start of the buffer */
113 u_long sc_play_end
; /* end */
115 void (*sc_playintr
)(void *);
129 int sc_playbuf_available
;
130 int sc_recbuf_available
;
139 u_char sc_recsrcbits
;
140 int (*sc_ih
)(void *);
141 iw_port_info_t sc_mic
;
142 iw_port_info_t sc_aux1
;
143 iw_port_info_t sc_aux2
;
144 iw_port_info_t sc_linein
;
145 iw_port_info_t sc_lineout
;
146 iw_port_info_t sc_rec
;
147 iw_port_info_t sc_dac
;
148 iw_port_info_t sc_loopback
;
149 iw_port_info_t sc_monoin
;
150 volatile u_short flags
; /* InterWave stat flags */
152 bus_space_handle_t dir_h
; /* dummy handle for direct access*/
153 int codec_index
; /* Base Port for Codec */
154 bus_space_handle_t codec_index_h
;
155 isa_chipset_tag_t sc_codec_ic
;
156 int pcdrar
; /* Base Port for Ext Device */
157 int p2xr
; /* Compatibility Base Port */
158 bus_space_handle_t p2xr_h
;
159 isa_chipset_tag_t sc_p2xr_ic
;
160 int p3xr
; /* MIDI and Synth Base Port */
161 bus_space_handle_t p3xr_h
;
162 isa_chipset_tag_t sc_p3xr_ic
;
163 int p401ar
; /* Gen Purpose Reg. 1 address */
164 int p201ar
; /* Game Ctrl normally at 0x201 */
165 int pataar
; /* Base Address for ATAPI I/O Space */
167 int p388ar
; /* Base Port for AdLib. It should bbe 388h */
168 int pnprdp
; /* PNP read data port */
169 int igidxr
; /* Gen Index Reg at P3XR+0x03 */
170 int i16dp
; /* 16-bit data port at P3XR+0x04 */
171 int i8dp
; /* 8-bit data port at P3XR+0x05 */
172 int svsr
; /* Synth Voice Select at P3XR+0x02 */
173 int cdatap
; /* Codec Indexed Data Port at PCODAR+0x01 */
174 int csr1r
; /* Codec Stat Reg 1 at PCODAR+0x02 */
175 int cxdr
; /* Play or Record Data Reg at PCODAR+0x03 */
176 int gmxr
; /* GMCR or GMSR at P3XR+0x00 */
177 int gmxdr
; /* GMTDR or GMRDR at P3XR+0x01 */
178 int lmbdr
; /* LMBDR at P3XR+0x07 */
179 u_char csn
; /* Card Select Number */
180 u_char cmode
; /* Codec Operation Mode */
181 int dma1_chan
; /* DMA channel 1 (local DMA & codec rec) */
182 int dma2_chan
; /* DMA channel 2 (codec play) */
183 int ext_chan
; /* Ext Dev DMA channel */
184 u_char voices
; /* Number of active voices */
185 u_long vendor
; /* Vendor ID and Product Identifier */
186 long free_mem
; /* Address of First Free LM Block */
187 long reserved_mem
; /* Amount of LM reserved by app. */
188 u_char smode
; /* Synth Mode */
189 long size_mem
; /* Total LM in bytes */
190 struct cfdriver
*iw_cd
;
191 const struct audio_hw_if
*iw_hw_if
;
194 void iwattach(struct iw_softc
*);
196 int iwopen(struct iw_softc
*, int); /* open hardware */
197 void iwclose(void *); /* close hardware */
200 /* XXX should we have separate in/out? */
201 int iw_query_encoding(void *, struct audio_encoding
*);
202 int iw_set_params(void *, int, int, audio_params_t
*, audio_params_t
*,
203 stream_filter_list_t
*, stream_filter_list_t
*);
205 /* Hardware may have some say in the blocksize to choose */
206 int iw_round_blocksize(void *, int, int, const audio_params_t
*);
208 int iw_commit_settings(void *);
210 /* Software en/decode functions, set if SW coding required by HW */
211 void iw_sw_encode(void *, int, u_char
*, int);
212 void iw_sw_decode(void *, int, u_char
*, int);
214 /* Start input/output routines. These usually control DMA. */
215 int iw_start_output(void *, void *, int, void (*)(void *), void *);
216 int iw_start_input(void *, void *, int, void (*)(void *), void *);
218 int iw_init_input(void *, void *, int);
219 int iw_init_output(void *, void *, int);
220 int iw_halt_output(void *);
221 int iw_halt_input(void *);
223 int iw_speaker_ctl(void *, int);
224 int iw_getdev(void *, struct audio_device
*);
225 int iw_setfd(void *, int);
227 /* Mixer (in/out ports) */
228 int iw_set_port(void *, mixer_ctrl_t
*);
229 int iw_get_port(void *, mixer_ctrl_t
*);
231 int iw_query_devinfo(void *, mixer_devinfo_t
*);
234 void * iw_malloc(void *, int, size_t, struct malloc_type
*, int);
235 void iw_free(void *,void *,struct malloc_type
*);
236 size_t iw_round_buffersize(void *, int, size_t);
237 paddr_t
iw_mappage(void *, void *, off_t
, int);
238 int iw_get_props(void *);
240 #endif /* INTERWAVEVAR_H */