summaryrefslogtreecommitdiff
path: root/sys/dev/pci/auixpvar.h
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2005-08-07 20:08:46 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2005-08-07 20:08:46 +0000
commit46f1a7f7b1ac726229e74770fd86fd62e623d476 (patch)
treed115daaae50c34047bd6cda9c8e47cf4d93bcd3c /sys/dev/pci/auixpvar.h
parent58300de4038ca19d004ad787ee607ce9f3451a63 (diff)
ati ixp audio; ported form ntbsd in <4h of boretime; testing by krw@ and ian@
Diffstat (limited to 'sys/dev/pci/auixpvar.h')
-rw-r--r--sys/dev/pci/auixpvar.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/sys/dev/pci/auixpvar.h b/sys/dev/pci/auixpvar.h
new file mode 100644
index 00000000000..348ece9d050
--- /dev/null
+++ b/sys/dev/pci/auixpvar.h
@@ -0,0 +1,121 @@
+/* $OpenBSD: auixpvar.h,v 1.1 2005/08/07 20:08:45 mickey Exp $ */
+/* $NetBSD: auixpvar.h,v 1.3 2005/01/12 15:54:34 kent Exp $*/
+
+/*
+ * Copyright (c) 2004, 2005 Reinoud Zandijk <reinoud@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+/*
+ * NetBSD audio driver for ATI IXP-{150,200,...} audio driver hardware.
+ */
+
+#define DMA_DESC_CHAIN 255
+
+/* audio format structure describing our hardware capabilities */
+/* XXX min and max sample rates are for AD1888 codec XXX */
+#define AUIXP_NFORMATS 6
+
+#define AUIXP_MINRATE 7000
+#define AUIXP_MAXRATE 48000
+
+/* auixp structures; used to record alloced DMA space */
+struct auixp_dma {
+ /* bus mappings */
+ bus_dmamap_t map;
+ caddr_t addr;
+ bus_dma_segment_t segs[1];
+ int nsegs;
+ size_t size;
+
+ /* audio feeder */
+ void (*intr)(void *);
+ void *intrarg;
+
+ /* status and setup bits */
+ int running;
+ u_int32_t linkptr;
+ u_int32_t dma_enable_bit;
+
+ /* linked list of all mapped area's */
+ SLIST_ENTRY(auixp_dma) dma_chain;
+};
+
+struct auixp_codec {
+ struct auixp_softc *sc;
+
+ int present;
+ int codec_nr;
+
+ struct ac97_codec_if *codec_if;
+ struct ac97_host_if host_if;
+ enum ac97_host_flags codec_flags;
+};
+
+struct auixp_softc {
+ struct device sc_dev;
+ audio_device_t sc_audev;
+ void *sc_ih;
+
+ /* card properties */
+ int has_4ch, has_6ch, is_fixed, has_spdif;
+
+ /* bus tags */
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+ bus_addr_t sc_iob;
+ bus_size_t sc_ios;
+
+ pcitag_t sc_tag;
+ pci_chipset_tag_t sc_pct;
+
+ bus_dma_tag_t sc_dmat;
+
+ /* DMA business */
+ struct auixp_dma *sc_output_dma;
+ struct auixp_dma *sc_input_dma;
+
+ /* list of allocated DMA pieces */
+ SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list;
+
+ /* codecs */
+ int sc_num_codecs;
+ struct auixp_codec sc_codec[ATI_IXP_CODECS];
+ int sc_codec_not_ready_bits;
+
+ /* last set audio parameters */
+ struct audio_params sc_play_params;
+ struct audio_params sc_rec_params;
+
+ /* suspend/resume */
+ void *powerhook;
+ u_int16_t *savemem;
+};