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