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