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