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