audioemu10k.h revision 992413f4053d9470046876b234fe094062b730b7
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * CDDL HEADER START
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 * 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 * 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 * CDDL HEADER END
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Use is subject to license terms.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Purpose: Definitions for the SB Live/Audigy driver
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Copyright (C) 4Front Technologies 1996-2009.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define EMU10K_NUM_FRAGS (2*4) /* Must be multiple of 2 */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Audio buffer + silent page */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define AUDIO_MEMSIZE (EMU10K_NUM_PORTC*DMABUF_SIZE+4096)
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Wall clock register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Hardware config register */
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_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_MUTEBUTTONENABLE 0x00000002 /* Mute can clear audioenable */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define HCFG_AUDIOENABLE 0x00000001 /* Codecs can send data */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_HCFG_XM 0x00040000 /* Xtended address mode */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * GPIO bit definitions (global register 0x18) for Audigy.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define A_IOCFG_GPOUT0 0x0044 /* analog/digital? */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Status bits (read only) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_VERSAPLUGGED 0x2000 /* Center/LFE/digital */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPIO_DIGITAL_ENABLE 0x0004 /* Cen/lfe (0) or digital (1) switch */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_put32(devc->pt_acch, devc->page_map + e, ((v) << 1) | (e));
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Audio block registers
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CPF 0x000 /* DW:cnl Current pitch and fraction */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PTAB 0x001 /* DW:cnl Pitch target and sends A and B */
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 PEFE_PITCHAMOUNT_MASK 0x0000ff00 /* Pitch envlope amount */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define PEFE_FILTERAMOUNT_MASK 0x000000ff /* Filter envlope amount */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define CD0 0x020 /* DW:cnl (16 registers) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Half loop interrupt registers (audigy only) */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define GPR0 ((devc->feature_mask&SB_LIVE)? 0x100:0x400) /* DW:nocnl */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#define UC0 ((devc->feature_mask&SB_LIVE) ? 0x400:0x600) /* DSM ucode */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interrupt pending register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interrupt enable register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* Interval timer register */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* EMU10K2 MIDI UART */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore/* EMU10K2 S/PDIF recording buffer */
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/* See feature_mask below */
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'Amoretypedef struct _emu10k_portc_t emu10k_portc_t;
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef enum {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* monitor source values */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* this one must be last */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_ctrl {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amoretypedef struct _emu10k_gpr {
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Helper functions */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t buf_dmah; /* dma for buffers */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Start of loop within the internal memory space */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore /* Position & timing */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t pt_dmah; /* dma for page_tablefers */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore uint32_t *page_map; /* up to 8k ptrs to 4k pages */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore * Silent page used by voices that don't play anything.
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore ddi_dma_handle_t silence_dmah; /* dma for silencefers */
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#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#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#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#define EMU10K_KIOP(X) ((kstat_intr_t *)(X->ksp->ks_data))
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#endif /* _KERNEL */
992413f4053d9470046876b234fe094062b730b7Garrett D'Amore#endif /* EMU10K_H */