Home | History | Annotate | Line # | Download | only in pci
auixpvar.h revision 1.8
      1  1.8       chs /* $NetBSD: auixpvar.h,v 1.8 2012/10/27 17:18:28 chs Exp $*/
      2  1.1   reinoud 
      3  1.1   reinoud /*
      4  1.2   reinoud  * Copyright (c) 2004, 2005 Reinoud Zandijk <reinoud (at) netbsd.org>
      5  1.1   reinoud  * All rights reserved.
      6  1.1   reinoud  *
      7  1.1   reinoud  * Redistribution and use in source and binary forms, with or without
      8  1.1   reinoud  * modification, are permitted provided that the following conditions
      9  1.1   reinoud  * are met:
     10  1.1   reinoud  * 1. Redistributions of source code must retain the above copyright
     11  1.1   reinoud  *    notice, this list of conditions and the following disclaimer.
     12  1.1   reinoud  * 2. The name of the author may not be used to endorse or promote products
     13  1.1   reinoud  *    derived from this software without specific prior written permission.
     14  1.1   reinoud  * 3. All advertising materials mentioning features or use of this software
     15  1.1   reinoud  *    must display the following acknowledgement:
     16  1.1   reinoud  *	This product includes software developed by the NetBSD
     17  1.1   reinoud  *	Foundation, Inc. and its contributors.
     18  1.1   reinoud  * 4. Neither the name of The NetBSD Foundation nor the names of its
     19  1.1   reinoud  *    contributors may be used to endorse or promote products derived
     20  1.1   reinoud  *    from this software without specific prior written permission.
     21  1.1   reinoud  *
     22  1.1   reinoud  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  1.1   reinoud  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  1.1   reinoud  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1   reinoud  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  1.1   reinoud  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     27  1.1   reinoud  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     28  1.1   reinoud  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     29  1.1   reinoud  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     30  1.1   reinoud  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1   reinoud  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1   reinoud  * SUCH DAMAGE.
     33  1.1   reinoud  */
     34  1.1   reinoud 
     35  1.1   reinoud 
     36  1.1   reinoud /*
     37  1.1   reinoud  * NetBSD audio driver for ATI IXP-{150,200,...} audio driver hardware.
     38  1.1   reinoud  */
     39  1.1   reinoud 
     40  1.1   reinoud #define DMA_DESC_CHAIN	255
     41  1.1   reinoud 
     42  1.1   reinoud 
     43  1.1   reinoud /* audio format structure describing our hardware capabilities */
     44  1.1   reinoud /* XXX min and max sample rates are for AD1888 codec XXX */
     45  1.1   reinoud #define AUIXP_NFORMATS 6
     46  1.1   reinoud 
     47  1.1   reinoud 
     48  1.1   reinoud #define AUIXP_MINRATE  7000
     49  1.1   reinoud #define AUIXP_MAXRATE 48000
     50  1.1   reinoud 
     51  1.1   reinoud 
     52  1.1   reinoud /* current AC'97 driver only supports SPDIF outputting channel 3&4 i.e. STEREO */
     53  1.1   reinoud static const struct audio_format auixp_formats[AUIXP_NFORMATS] = {
     54  1.1   reinoud 	{NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 2, AUFMT_STEREO, 0, {7000, 48000}},
     55  1.1   reinoud 	{NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 2, AUFMT_STEREO, 0, {7000, 48000}},
     56  1.1   reinoud 	{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
     57  1.1   reinoud 	{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
     58  1.1   reinoud 	{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
     59  1.1   reinoud 	{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
     60  1.1   reinoud };
     61  1.1   reinoud 
     62  1.1   reinoud 
     63  1.1   reinoud /* auixp structures; used to record alloced DMA space */
     64  1.1   reinoud struct auixp_dma {
     65  1.1   reinoud 	/* bus mappings */
     66  1.1   reinoud 	bus_dmamap_t		 map;
     67  1.5  christos 	void *			 addr;
     68  1.1   reinoud 	bus_dma_segment_t	 segs[1];
     69  1.1   reinoud 	int			 nsegs;
     70  1.1   reinoud 	size_t			 size;
     71  1.1   reinoud 
     72  1.1   reinoud 	/* audio feeder */
     73  1.1   reinoud 	void			 (*intr)(void *);	/* function to call when there is space */
     74  1.1   reinoud 	void			*intrarg;
     75  1.1   reinoud 
     76  1.1   reinoud 	/* status and setup bits */
     77  1.1   reinoud 	int			 running;
     78  1.1   reinoud 	uint32_t		 linkptr;
     79  1.1   reinoud 	uint32_t		 dma_enable_bit;
     80  1.1   reinoud 
     81  1.1   reinoud 	/* linked list of all mapped area's */
     82  1.1   reinoud 	SLIST_ENTRY(auixp_dma)	 dma_chain;
     83  1.1   reinoud };
     84  1.1   reinoud 
     85  1.1   reinoud 
     86  1.1   reinoud struct auixp_codec {
     87  1.1   reinoud 	struct auixp_softc	*sc;
     88  1.1   reinoud 
     89  1.1   reinoud 	int			 present;
     90  1.1   reinoud 	int			 codec_nr;
     91  1.1   reinoud 
     92  1.1   reinoud 	struct ac97_codec_if	*codec_if;
     93  1.1   reinoud 	struct ac97_host_if	 host_if;
     94  1.1   reinoud 	enum ac97_host_flags	 codec_flags;
     95  1.1   reinoud };
     96  1.1   reinoud 
     97  1.1   reinoud 
     98  1.1   reinoud struct auixp_softc {
     99  1.8       chs 	device_t		sc_dev;
    100  1.7  jmcneill 	kmutex_t		sc_lock;
    101  1.7  jmcneill 	kmutex_t		sc_intr_lock;
    102  1.1   reinoud 
    103  1.1   reinoud 	/* card id */
    104  1.1   reinoud 	int			type;
    105  1.1   reinoud 	int			delay1, delay2;		/* nessisary? */
    106  1.1   reinoud 
    107  1.1   reinoud 	/* card properties */
    108  1.1   reinoud 	int			has_4ch, has_6ch, is_fixed, has_spdif;
    109  1.1   reinoud 
    110  1.1   reinoud 	/* bus tags */
    111  1.1   reinoud 	bus_space_tag_t		sc_iot;
    112  1.1   reinoud 	bus_space_handle_t	sc_ioh;
    113  1.1   reinoud 	bus_addr_t		sc_iob;
    114  1.1   reinoud 	bus_size_t		sc_ios;
    115  1.1   reinoud 
    116  1.1   reinoud 	pcitag_t		sc_tag;
    117  1.1   reinoud 	pci_chipset_tag_t	sc_pct;
    118  1.1   reinoud 
    119  1.1   reinoud 	bus_dma_tag_t		sc_dmat;
    120  1.1   reinoud 
    121  1.1   reinoud 	/* interrupts */
    122  1.1   reinoud 	void			*sc_ih;
    123  1.1   reinoud 
    124  1.1   reinoud 	/* DMA business */
    125  1.1   reinoud 	struct auixp_dma	*sc_output_dma;		/* contains dma-safe chain */
    126  1.1   reinoud 	struct auixp_dma	*sc_input_dma;
    127  1.1   reinoud 
    128  1.1   reinoud 	/* list of allocated DMA pieces */
    129  1.1   reinoud 	SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list;
    130  1.1   reinoud 
    131  1.1   reinoud 	/* audio formats supported */
    132  1.1   reinoud 	struct audio_format sc_formats[AUIXP_NFORMATS];
    133  1.1   reinoud 	struct audio_encoding_set *sc_encodings;
    134  1.1   reinoud 
    135  1.1   reinoud 	/* codecs */
    136  1.1   reinoud 	int			sc_num_codecs;
    137  1.1   reinoud 	struct auixp_codec	sc_codec[ATI_IXP_CODECS];
    138  1.1   reinoud 	int			sc_codec_not_ready_bits;
    139  1.1   reinoud 
    140  1.1   reinoud 	/* last set audio parameters */
    141  1.1   reinoud 	struct audio_params	sc_play_params;
    142  1.1   reinoud 	struct audio_params	sc_rec_params;
    143  1.1   reinoud };
    144  1.1   reinoud 
    145  1.1   reinoud 
    146