992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * CDDL HEADER START
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore *
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * The contents of this file are subject to the terms of the
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Common Development and Distribution License (the "License").
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * You may not use this file except in compliance with the License.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore *
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * or http://www.opensolaris.org/os/licensing.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * See the License for the specific language governing permissions
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * and limitations under the License.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore *
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore *
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * CDDL HEADER END
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Use is subject to license terms.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Purpose: Definitions for the SB Live/Audigy driver
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Copyright (C) 4Front Technologies 1996-2009.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#ifndef EMU10K_H
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_H
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PCI_VENDOR_ID_CREATIVE 0x1102
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PCI_DEVICE_ID_SBLIVE 0x0002
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PCI_DEVICE_ID_AUDIGY 0x0004
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PCI_DEVICE_ID_AUDIGYVALUE 0x0008
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SAMPLE_RATE 48000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_NAME "audioemu10k"
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_NUM_PORTC 2
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_PLAY 0
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_REC 1
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_NUM_FRAGS (2*4) /* Must be multiple of 2 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_MAX_INTRS 512
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_MIN_INTRS 10
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_INTRS 100
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FRAGMENT_FRAMES 512
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K1_MAGIC 0xe10001
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K2_MAGIC 0xe10002
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Audio */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define DMABUF_SIZE (256 * 1024)
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AUDIO_MAXVOICE (2*EMU10K_NUM_PORTC)
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Audio buffer + silent page */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AUDIO_MEMSIZE (EMU10K_NUM_PORTC*DMABUF_SIZE+4096)
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Wall clock register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define WC 0x10
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Hardware config register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG 0x14
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_CODECFORMAT_MASK 0x00070000 /* CODEC format */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_CODECFORMAT_AC97 0x00000000 /* AC97 CODEC format */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_CODECFORMAT_I2S 0x00010000 /* I2S CODEC format */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPINPUT0 0x00004000 /* External pin112 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPINPUT1 0x00002000 /* External pin110 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPOUTPUT_MASK 0x00001c00 /* Controllable pins */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPOUT0 0x00001000 /* enable dig out on 5.1 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPOUT1 0x00000800 /* IR */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_GPOUT2 0x00000400 /* IR */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_JOYENABLE 0x00000200 /* Internal joystick enable */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_PHASETRACKENABLE 0x00000100 /* Phase tracking enable */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AC3ENABLE_MASK 0x0x0000e0 /* AC3 async input control */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AC3ENABLE_ZVIDEO 0x00000080 /* Chan 0/1 replace ZVIDEO */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AC3ENABLE_CDSPDIF 0x00000040 /* Chan 0/1 replace CDSPDIF */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AC3ENABLE_GPSPDIF 0x00000020 /* Chan 0/1 replace GPSPDIF */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AUTOMUTE 0x00000010
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_LOCKSOUNDCACHE 0x00000008
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_LOCKTANKCACHE_MASK 0x00000004
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_LOCKTANKCACHE 0x01020014
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_MUTEBUTTONENABLE 0x00000002 /* Mute can clear audioenable */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AUDIOENABLE 0x00000001 /* Codecs can send data */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_HCFG_VMUTE 0x00004000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_HCFG_AUTOMUTE 0x00008000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_HCFG_XM 0x00040000 /* Xtended address mode */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * GPIO bit definitions (global register 0x18) for Audigy.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_IOCFG_GPOUT0 0x0044 /* analog/digital? */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_IOCFG_GPOUT1 0x0002 /* IR */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_IOCFG_GPOUT2 0x0001 /* IR */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Status bits (read only) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_VERSAPLUGGED 0x2000 /* Center/LFE/digital */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_FRONTPLUGGED 0x4000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_REARPLUGGED 0x8000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_HEADPHPLUGGED 0x0100
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_ANALOG_MUTE 0x0040
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_DIGITAL_ENABLE 0x0004 /* Cen/lfe (0) or digital (1) switch */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FILL_PAGE_MAP_ENTRY(e, v) \
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_put32(devc->pt_acch, devc->page_map + e, ((v) << 1) | (e));
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Audio block registers
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF 0x000 /* DW:cnl Current pitch and fraction */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF_CURRENTPITCH_MASK 0xffff0000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF_CURRENTPITCH 0x10100000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF_STEREO_MASK 0x00008000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF_STOP_MASK 0x00004000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF_FRACADDRESS_MASK 0x00003fff
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTAB 0x001 /* DW:cnl Pitch target and sends A and B */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_PITCHTARGET_MASK 0xffff0000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_PITCHTARGET 0x10100001
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_FXSENDAMOUNT_A_MASK 0x0000ff00
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_FXSENDAMOUNT_A 0x08080001
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_FXSENDAMOUNT_B_MASK 0x000000ff
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTRX_FXSENDAMOUNT_B 0x08000001
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CVCF 0x002 /* DW:cnl Curr vol and curr filter cutoff */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VTFT 0x003 /* DW:cnl Volume tgt and filter cutoff tgt */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define Z2 0x004 /* DW:cnl Filter delay memory 2 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define Z1 0x005 /* DW:cnl Filter delay memory 1 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SCSA 0x006 /* DW:cnl Send C and Start addr */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SDL 0x007 /* DW:cnl Send D and Loop addr */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define QKBCA 0x008 /* DW:cnl Filter Q, ROM, etc */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR 0x009
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_CACHEINVALIDSIZE 0x07190009
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_CACHELOOPFLAG 0x01000000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_INTERLEAVEDSAMPLES 0x00800000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_WORDSIZEDSAMPLES 0x00400000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_READADDRESS 0x06100009
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_READADDRESS_MASK 0x003f0000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_LOOPINVALSIZE 0x0000fe00
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_LOOPFLAG 0x00000100
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CCR_CACHELOOPADDRHI 0x000000ff
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CLP 0x00a
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SRHE 0x07c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define STHE 0x07d
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SRDA 0x07e
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define STDA 0x07f
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define L_FXRT 0x00b
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FXRT 0x00b /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MAPA 0x00c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MAPB 0x00d
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VEV 0x010 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VEHA 0x011 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VEDS 0x012 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MLV 0x013 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MEV 0x014 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MEHA 0x015 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MEDS 0x016 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VLV 0x017 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IP 0x018 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IFA 0x019 /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE 0x01a /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE_PITCHAMOUNT_MASK 0x0000ff00 /* Pitch envlope amount */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE_PITCHAMOUNT 0x0808001a
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE_FILTERAMOUNT_MASK 0x000000ff /* Filter envlope amount */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE_FILTERAMOUNT 0x0800001a
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VFM 0x01b /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TMFQ 0x01c /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define VVFQ 0x01d /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TMPE 0x01e /* W:cnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CD0 0x020 /* DW:cnl (16 registers) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTBA 0x040 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TCBA 0x041 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ADCSR 0x042 /* B:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FXWC 0x043 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TCBS 0x044 /* B:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MBA 0x045 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ADCBA 0x046 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FXBA 0x047 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MBS 0x049 /* B:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ADCBS 0x04a /* B:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FXBS 0x04b /* B:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CSBA 0x4c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CSDC 0x4d
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CSFE 0x4e
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CSHG 0x4f
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CDCS 0x050 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPSCS 0x051 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define DBG 0x052 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AUDIGY_DBG 0x053 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SCS0 0x054 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SCS1 0x055 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SCS2 0x056 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CLIEL 0x058 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CLIEH 0x059 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CLIPL 0x05a /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CLIPH 0x05b /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SOLL 0x05c /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SOLH 0x05d /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SOC 0x05e /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AC97SLOT 0x05f
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AC97SLOT_REAR_RIGHT 0x01
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AC97SLOT_REAR_LEFT 0x02
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AC97SLOT_CENTER 0x10
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AC97SLOT_LFE 0x20
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CDSRCS 0x060 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPSRCS 0x061 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ZVSRCS 0x062 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ADCIDX 0x063 /* W:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MIDX 0x064 /* W:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define FXIDX 0x065 /* W:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Half loop interrupt registers (audigy only) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HLIEL 0x066 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HLIEH 0x067 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HLIPL 0x068 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HLIPH 0x069 /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPR0 ((devc->feature_mask&SB_LIVE)? 0x100:0x400) /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TMA0 0x300 /* Tank memory */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define UC0 ((devc->feature_mask&SB_LIVE) ? 0x400:0x600) /* DSM ucode */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interrupt pending register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INTPEND 0x08
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_VI 0x00100000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_VD 0x00080000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_MU 0x00040000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_MF 0x00020000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_MH 0x00010000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_AF 0x00008000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_AH 0x00004000
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_IT 0x00000200
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_TX 0x00000100
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_RX 0x00000080
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INT_CL 0x00000040
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interrupt enable register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE 0x0c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_VI 0x00000400
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_VD 0x00000200
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_MU 0x00000100
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_MB 0x00000080
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_AB 0x00000040
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_IT 0x00000004
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_TX 0x00000002
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define IE_RX 0x00000001
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interval timer register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define TIMR 0x1a
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* EMU10K2 MIDI UART */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MUADAT 0x070
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MUACMD 0x071
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MUASTAT MUACMD
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* EMU10K2 S/PDIF recording buffer */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SPRI 0x6a
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SPRA 0x6b
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SPRC 0x6c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EHC 0x76 /* Audigy 2 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SRHE 0x07c
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define STHE 0x07d
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SRDA 0x07e
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM0 0x00000000 /* interpolation ROM 0 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM1 0x02000000 /* interpolation ROM 1 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM2 0x04000000 /* interpolation ROM 2 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM3 0x06000000 /* interpolation ROM 3 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM4 0x08000000 /* interpolation ROM 4 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM5 0x0A000000 /* interpolation ROM 5 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM6 0x0C000000 /* interpolation ROM 6 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define ROM7 0x0E000000 /* interpolation ROM 7 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define BYTESIZE 0x01000000 /* byte sound memory */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define MAX_GPR 256
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* See feature_mask below */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_LIVE 1
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_AUDIGY 2
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_AUDIGY2 4
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_AUDIGY2VAL 8
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_51 0x10
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_71 0x20
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_INVSP 0x40 /* invert shared spdif switch */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define SB_NOEXP 0x80 /* no support for Live! Drive or expansion */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define LEFT_CH 0
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define RIGHT_CH 1
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#ifdef _KERNEL
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_devc_t emu10k_devc_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_portc_t emu10k_portc_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef enum {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_VOLUME = 0,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_FRONT,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_SURROUND,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_CENTER,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_LFE,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_SIDE,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_HEADPH,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_RECGAIN,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_RECSRC,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_AC97SRC,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* monitor source values */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_AC97,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_DIGCD,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_SPD1,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_SPD2,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_LINE2,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_AUX2,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_JACK3,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* this one must be last */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore CTL_MAX,
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore} emu10k_ctrl_id_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_ctrl {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore emu10k_devc_t *devc;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore audio_ctrl_t *ctrl;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int gpr_num;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint64_t val;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore} emu10k_ctrl_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_gpr {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore boolean_t valid;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t value;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore} emu10k_gpr_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amorestruct _emu10k_portc_t {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore emu10k_devc_t *devc;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore audio_engine_t *engine;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Helper functions */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore void (*update_port)(emu10k_portc_t *);
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore void (*reset_port)(emu10k_portc_t *);
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore void (*stop_port)(emu10k_portc_t *);
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore void (*start_port)(emu10k_portc_t *);
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int channels;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore boolean_t started;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore boolean_t active;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore unsigned nframes;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore unsigned nfrags;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore unsigned fragsz;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t buf_dmah; /* dma for buffers */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_acc_handle_t buf_acch;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t buf_paddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore caddr_t buf_kaddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore size_t buf_size;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Start of loop within the internal memory space */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t memptr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int syncdir;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Position & timing */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint64_t count;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t pos;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int dopos;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore};
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amorestruct _emu10k_devc_t {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore dev_info_t *dip;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore audio_dev_t *adev;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_acc_handle_t pcih;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_acc_handle_t regsh;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore caddr_t regs;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore kmutex_t mutex;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Page table
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t pt_dmah; /* dma for page_tablefers */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_acc_handle_t pt_acch;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t pt_paddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore caddr_t pt_kaddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t *page_map; /* up to 8k ptrs to 4k pages */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Silent page used by voices that don't play anything.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t silence_dmah; /* dma for silencefers */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_acc_handle_t silence_acch;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t silence_paddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore caddr_t silence_kaddr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Device feature mask tells which kind of features are
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * supported by the hardware. Audigy2/2val have multiple bits
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * set while Live! has just the SB_LIVE bits. So Features of
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Audigy will be reported by Audigy2/val too.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int feature_mask;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int max_mem, max_pages, nr_pages;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Mixer
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ac97_t *ac97;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ac97_ctrl_t *ac97_recsrc;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t ac97_stereomix;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore emu10k_gpr_t gpr_shadow[MAX_GPR];
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore emu10k_ctrl_t ctrls[CTL_MAX];
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /*
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Audio
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int audio_memptr;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore int *silent_page;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore emu10k_portc_t *portc[EMU10K_NUM_PORTC];
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore};
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INB(devc, reg) ddi_get8(devc->regsh, (void *)(reg))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define OUTB(devc, val, reg) ddi_put8(devc->regsh, (void *)(reg), (val))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INW(devc, reg) ddi_get16(devc->regsh, (void *)(reg))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define OUTW(devc, val, reg) ddi_put16(devc->regsh, (void *)(reg), (val))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define INL(devc, reg) ddi_get32(devc->regsh, (void *)(reg))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define OUTL(devc, val, reg) ddi_put32(devc->regsh, (void *)(reg), (val))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#endif /* _KERNEL */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#endif /* EMU10K_H */