1 1.11 andvar /* $NetBSD: auixpvar.h,v 1.11 2021/08/20 20:25:28 andvar 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 * 15 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 1.1 reinoud * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 1.1 reinoud * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 1.1 reinoud * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 1.1 reinoud * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 1.1 reinoud * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 1.1 reinoud * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 1.1 reinoud * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 1.1 reinoud * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 1.1 reinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 1.1 reinoud * SUCH DAMAGE. 26 1.1 reinoud */ 27 1.1 reinoud 28 1.1 reinoud 29 1.1 reinoud /* 30 1.1 reinoud * NetBSD audio driver for ATI IXP-{150,200,...} audio driver hardware. 31 1.1 reinoud */ 32 1.1 reinoud 33 1.1 reinoud #define DMA_DESC_CHAIN 255 34 1.1 reinoud 35 1.1 reinoud 36 1.1 reinoud /* audio format structure describing our hardware capabilities */ 37 1.1 reinoud /* XXX min and max sample rates are for AD1888 codec XXX */ 38 1.9 isaki #define AUIXP_NFORMATS 3 39 1.1 reinoud 40 1.1 reinoud 41 1.1 reinoud #define AUIXP_MINRATE 7000 42 1.1 reinoud #define AUIXP_MAXRATE 48000 43 1.1 reinoud 44 1.1 reinoud 45 1.1 reinoud /* auixp structures; used to record alloced DMA space */ 46 1.1 reinoud struct auixp_dma { 47 1.1 reinoud /* bus mappings */ 48 1.1 reinoud bus_dmamap_t map; 49 1.5 christos void * addr; 50 1.1 reinoud bus_dma_segment_t segs[1]; 51 1.1 reinoud int nsegs; 52 1.1 reinoud size_t size; 53 1.1 reinoud 54 1.1 reinoud /* audio feeder */ 55 1.1 reinoud void (*intr)(void *); /* function to call when there is space */ 56 1.1 reinoud void *intrarg; 57 1.1 reinoud 58 1.1 reinoud /* status and setup bits */ 59 1.1 reinoud int running; 60 1.1 reinoud uint32_t linkptr; 61 1.1 reinoud uint32_t dma_enable_bit; 62 1.1 reinoud 63 1.1 reinoud /* linked list of all mapped area's */ 64 1.1 reinoud SLIST_ENTRY(auixp_dma) dma_chain; 65 1.1 reinoud }; 66 1.1 reinoud 67 1.1 reinoud 68 1.1 reinoud struct auixp_codec { 69 1.1 reinoud struct auixp_softc *sc; 70 1.1 reinoud 71 1.1 reinoud int present; 72 1.1 reinoud int codec_nr; 73 1.1 reinoud 74 1.1 reinoud struct ac97_codec_if *codec_if; 75 1.1 reinoud struct ac97_host_if host_if; 76 1.1 reinoud enum ac97_host_flags codec_flags; 77 1.1 reinoud }; 78 1.1 reinoud 79 1.1 reinoud 80 1.1 reinoud struct auixp_softc { 81 1.8 chs device_t sc_dev; 82 1.7 jmcneill kmutex_t sc_lock; 83 1.7 jmcneill kmutex_t sc_intr_lock; 84 1.1 reinoud 85 1.1 reinoud /* card id */ 86 1.1 reinoud int type; 87 1.11 andvar int delay1, delay2; /* necessary? */ 88 1.1 reinoud 89 1.1 reinoud /* card properties */ 90 1.1 reinoud int has_4ch, has_6ch, is_fixed, has_spdif; 91 1.1 reinoud 92 1.1 reinoud /* bus tags */ 93 1.1 reinoud bus_space_tag_t sc_iot; 94 1.1 reinoud bus_space_handle_t sc_ioh; 95 1.1 reinoud bus_addr_t sc_iob; 96 1.1 reinoud bus_size_t sc_ios; 97 1.1 reinoud 98 1.1 reinoud pcitag_t sc_tag; 99 1.1 reinoud pci_chipset_tag_t sc_pct; 100 1.1 reinoud 101 1.1 reinoud bus_dma_tag_t sc_dmat; 102 1.1 reinoud 103 1.1 reinoud /* interrupts */ 104 1.1 reinoud void *sc_ih; 105 1.1 reinoud 106 1.1 reinoud /* DMA business */ 107 1.1 reinoud struct auixp_dma *sc_output_dma; /* contains dma-safe chain */ 108 1.1 reinoud struct auixp_dma *sc_input_dma; 109 1.1 reinoud 110 1.1 reinoud /* list of allocated DMA pieces */ 111 1.1 reinoud SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list; 112 1.1 reinoud 113 1.1 reinoud /* audio formats supported */ 114 1.1 reinoud struct audio_format sc_formats[AUIXP_NFORMATS]; 115 1.1 reinoud 116 1.1 reinoud /* codecs */ 117 1.1 reinoud int sc_num_codecs; 118 1.1 reinoud struct auixp_codec sc_codec[ATI_IXP_CODECS]; 119 1.1 reinoud int sc_codec_not_ready_bits; 120 1.1 reinoud 121 1.1 reinoud /* last set audio parameters */ 122 1.1 reinoud struct audio_params sc_play_params; 123 1.1 reinoud struct audio_params sc_rec_params; 124 1.1 reinoud }; 125 1.1 reinoud 126 1.1 reinoud 127