Home | History | Annotate | Line # | Download | only in pci
auixpvar.h revision 1.9
      1  1.9     isaki /* $NetBSD: auixpvar.h,v 1.9 2019/05/08 13:40:18 isaki 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.9     isaki #define AUIXP_NFORMATS 3
     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 /* auixp structures; used to record alloced DMA space */
     53  1.1   reinoud struct auixp_dma {
     54  1.1   reinoud 	/* bus mappings */
     55  1.1   reinoud 	bus_dmamap_t		 map;
     56  1.5  christos 	void *			 addr;
     57  1.1   reinoud 	bus_dma_segment_t	 segs[1];
     58  1.1   reinoud 	int			 nsegs;
     59  1.1   reinoud 	size_t			 size;
     60  1.1   reinoud 
     61  1.1   reinoud 	/* audio feeder */
     62  1.1   reinoud 	void			 (*intr)(void *);	/* function to call when there is space */
     63  1.1   reinoud 	void			*intrarg;
     64  1.1   reinoud 
     65  1.1   reinoud 	/* status and setup bits */
     66  1.1   reinoud 	int			 running;
     67  1.1   reinoud 	uint32_t		 linkptr;
     68  1.1   reinoud 	uint32_t		 dma_enable_bit;
     69  1.1   reinoud 
     70  1.1   reinoud 	/* linked list of all mapped area's */
     71  1.1   reinoud 	SLIST_ENTRY(auixp_dma)	 dma_chain;
     72  1.1   reinoud };
     73  1.1   reinoud 
     74  1.1   reinoud 
     75  1.1   reinoud struct auixp_codec {
     76  1.1   reinoud 	struct auixp_softc	*sc;
     77  1.1   reinoud 
     78  1.1   reinoud 	int			 present;
     79  1.1   reinoud 	int			 codec_nr;
     80  1.1   reinoud 
     81  1.1   reinoud 	struct ac97_codec_if	*codec_if;
     82  1.1   reinoud 	struct ac97_host_if	 host_if;
     83  1.1   reinoud 	enum ac97_host_flags	 codec_flags;
     84  1.1   reinoud };
     85  1.1   reinoud 
     86  1.1   reinoud 
     87  1.1   reinoud struct auixp_softc {
     88  1.8       chs 	device_t		sc_dev;
     89  1.7  jmcneill 	kmutex_t		sc_lock;
     90  1.7  jmcneill 	kmutex_t		sc_intr_lock;
     91  1.1   reinoud 
     92  1.1   reinoud 	/* card id */
     93  1.1   reinoud 	int			type;
     94  1.1   reinoud 	int			delay1, delay2;		/* nessisary? */
     95  1.1   reinoud 
     96  1.1   reinoud 	/* card properties */
     97  1.1   reinoud 	int			has_4ch, has_6ch, is_fixed, has_spdif;
     98  1.1   reinoud 
     99  1.1   reinoud 	/* bus tags */
    100  1.1   reinoud 	bus_space_tag_t		sc_iot;
    101  1.1   reinoud 	bus_space_handle_t	sc_ioh;
    102  1.1   reinoud 	bus_addr_t		sc_iob;
    103  1.1   reinoud 	bus_size_t		sc_ios;
    104  1.1   reinoud 
    105  1.1   reinoud 	pcitag_t		sc_tag;
    106  1.1   reinoud 	pci_chipset_tag_t	sc_pct;
    107  1.1   reinoud 
    108  1.1   reinoud 	bus_dma_tag_t		sc_dmat;
    109  1.1   reinoud 
    110  1.1   reinoud 	/* interrupts */
    111  1.1   reinoud 	void			*sc_ih;
    112  1.1   reinoud 
    113  1.1   reinoud 	/* DMA business */
    114  1.1   reinoud 	struct auixp_dma	*sc_output_dma;		/* contains dma-safe chain */
    115  1.1   reinoud 	struct auixp_dma	*sc_input_dma;
    116  1.1   reinoud 
    117  1.1   reinoud 	/* list of allocated DMA pieces */
    118  1.1   reinoud 	SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list;
    119  1.1   reinoud 
    120  1.1   reinoud 	/* audio formats supported */
    121  1.1   reinoud 	struct audio_format sc_formats[AUIXP_NFORMATS];
    122  1.1   reinoud 
    123  1.1   reinoud 	/* codecs */
    124  1.1   reinoud 	int			sc_num_codecs;
    125  1.1   reinoud 	struct auixp_codec	sc_codec[ATI_IXP_CODECS];
    126  1.1   reinoud 	int			sc_codec_not_ready_bits;
    127  1.1   reinoud 
    128  1.1   reinoud 	/* last set audio parameters */
    129  1.1   reinoud 	struct audio_params	sc_play_params;
    130  1.1   reinoud 	struct audio_params	sc_rec_params;
    131  1.1   reinoud };
    132  1.1   reinoud 
    133  1.1   reinoud 
    134