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