Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / auixpvar.h
blob9acb9f32ba343ea786f6015d8ae96e5ce508c94d
1 /* $NetBSD: auixpvar.h,v 1.5 2007/03/04 06:02:16 christos Exp $*/
3 /*
4 * Copyright (c) 2004, 2005 Reinoud Zandijk <reinoud@netbsd.org>
5 * All rights reserved.
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.
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.
37 * NetBSD audio driver for ATI IXP-{150,200,...} audio driver hardware.
40 #define DMA_DESC_CHAIN 255
43 /* audio format structure describing our hardware capabilities */
44 /* XXX min and max sample rates are for AD1888 codec XXX */
45 #define AUIXP_NFORMATS 6
48 #define AUIXP_MINRATE 7000
49 #define AUIXP_MAXRATE 48000
52 /* current AC'97 driver only supports SPDIF outputting channel 3&4 i.e. STEREO */
53 static const struct audio_format auixp_formats[AUIXP_NFORMATS] = {
54 {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 2, AUFMT_STEREO, 0, {7000, 48000}},
55 {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 2, AUFMT_STEREO, 0, {7000, 48000}},
56 {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
57 {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
58 {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
59 {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
63 /* auixp structures; used to record alloced DMA space */
64 struct auixp_dma {
65 /* bus mappings */
66 bus_dmamap_t map;
67 void * addr;
68 bus_dma_segment_t segs[1];
69 int nsegs;
70 size_t size;
72 /* audio feeder */
73 void (*intr)(void *); /* function to call when there is space */
74 void *intrarg;
76 /* status and setup bits */
77 int running;
78 uint32_t linkptr;
79 uint32_t dma_enable_bit;
81 /* linked list of all mapped area's */
82 SLIST_ENTRY(auixp_dma) dma_chain;
86 struct auixp_codec {
87 struct auixp_softc *sc;
89 int present;
90 int codec_nr;
92 struct ac97_codec_if *codec_if;
93 struct ac97_host_if host_if;
94 enum ac97_host_flags codec_flags;
98 struct auixp_softc {
99 struct device sc_dev;
101 /* card id */
102 int type;
103 int delay1, delay2; /* nessisary? */
105 /* card properties */
106 int has_4ch, has_6ch, is_fixed, has_spdif;
108 /* bus tags */
109 bus_space_tag_t sc_iot;
110 bus_space_handle_t sc_ioh;
111 bus_addr_t sc_iob;
112 bus_size_t sc_ios;
114 pcitag_t sc_tag;
115 pci_chipset_tag_t sc_pct;
117 bus_dma_tag_t sc_dmat;
119 /* interrupts */
120 void *sc_ih;
122 /* DMA business */
123 struct auixp_dma *sc_output_dma; /* contains dma-safe chain */
124 struct auixp_dma *sc_input_dma;
126 /* list of allocated DMA pieces */
127 SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list;
129 /* audio formats supported */
130 struct audio_format sc_formats[AUIXP_NFORMATS];
131 struct audio_encoding_set *sc_encodings;
133 /* codecs */
134 int sc_num_codecs;
135 struct auixp_codec sc_codec[ATI_IXP_CODECS];
136 int sc_codec_not_ready_bits;
138 /* last set audio parameters */
139 struct audio_params sc_play_params;
140 struct audio_params sc_rec_params;