xref: /onnv-gate/usr/src/uts/common/io/audio/drv/audiop16x/audiop16x.h (revision 11936:54dc8a89ba0d)
110463SGarrett.Damore@Sun.COM /*
210463SGarrett.Damore@Sun.COM  * CDDL HEADER START
310463SGarrett.Damore@Sun.COM  *
410463SGarrett.Damore@Sun.COM  * The contents of this file are subject to the terms of the
510463SGarrett.Damore@Sun.COM  * Common Development and Distribution License (the "License").
610463SGarrett.Damore@Sun.COM  * You may not use this file except in compliance with the License.
710463SGarrett.Damore@Sun.COM  *
810463SGarrett.Damore@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
910463SGarrett.Damore@Sun.COM  * or http://www.opensolaris.org/os/licensing.
1010463SGarrett.Damore@Sun.COM  * See the License for the specific language governing permissions
1110463SGarrett.Damore@Sun.COM  * and limitations under the License.
1210463SGarrett.Damore@Sun.COM  *
1310463SGarrett.Damore@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
1410463SGarrett.Damore@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1510463SGarrett.Damore@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
1610463SGarrett.Damore@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
1710463SGarrett.Damore@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
1810463SGarrett.Damore@Sun.COM  *
1910463SGarrett.Damore@Sun.COM  * CDDL HEADER END
2010463SGarrett.Damore@Sun.COM  */
2110463SGarrett.Damore@Sun.COM 
2210463SGarrett.Damore@Sun.COM /*
23*11936Sgdamore@opensolaris.org  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
2410463SGarrett.Damore@Sun.COM  * Use is subject to license terms.
2510463SGarrett.Damore@Sun.COM  */
2610463SGarrett.Damore@Sun.COM 
2710463SGarrett.Damore@Sun.COM /*
2810463SGarrett.Damore@Sun.COM  * Purpose: Definitions for the CS 4281 AC97 driver
2910463SGarrett.Damore@Sun.COM  */
3010463SGarrett.Damore@Sun.COM /*
3110463SGarrett.Damore@Sun.COM  * This file is part of Open Sound System
3210463SGarrett.Damore@Sun.COM  *
3310463SGarrett.Damore@Sun.COM  * Copyright (C) 4Front Technologies 1996-2009.
3410463SGarrett.Damore@Sun.COM  *
3510463SGarrett.Damore@Sun.COM  * This software is released under CDDL 1.0 source license.
3610463SGarrett.Damore@Sun.COM  * See the COPYING file included in the main directory of this source
3710463SGarrett.Damore@Sun.COM  * distribution for the license terms and conditions.
3810463SGarrett.Damore@Sun.COM  */
3910463SGarrett.Damore@Sun.COM #ifndef	AUDIOP16X_H
4010463SGarrett.Damore@Sun.COM #define	AUDIOP16X_H
4110463SGarrett.Damore@Sun.COM 
4210463SGarrett.Damore@Sun.COM #define	P16X_NAME		"audiop16x"
4310463SGarrett.Damore@Sun.COM 
4410463SGarrett.Damore@Sun.COM #define	P16X_NUM_PORT	2
4510463SGarrett.Damore@Sun.COM 
4610463SGarrett.Damore@Sun.COM #define	CREATIVE_VENDOR_ID	0x1102
4710463SGarrett.Damore@Sun.COM #define	SB_P16X_ID		0x0006
4810463SGarrett.Damore@Sun.COM 
4910463SGarrett.Damore@Sun.COM typedef struct _p16x_dev_t p16x_dev_t;
5010463SGarrett.Damore@Sun.COM typedef struct _p16x_port_t p16x_port_t;
5110463SGarrett.Damore@Sun.COM 
5210463SGarrett.Damore@Sun.COM struct _p16x_port_t
5310463SGarrett.Damore@Sun.COM {
5410463SGarrett.Damore@Sun.COM 	p16x_dev_t 		*dev;
5510463SGarrett.Damore@Sun.COM 	audio_engine_t 		*engine;
5610463SGarrett.Damore@Sun.COM 
5710463SGarrett.Damore@Sun.COM 	caddr_t			base;
5810463SGarrett.Damore@Sun.COM 
5910463SGarrett.Damore@Sun.COM 	int			port_num;
6010463SGarrett.Damore@Sun.COM #define	P16X_PLAY		0
6110463SGarrett.Damore@Sun.COM #define	P16X_REC		1
6210463SGarrett.Damore@Sun.COM 	ddi_dma_handle_t	buf_dmah;	/* dma for buffers */
6310463SGarrett.Damore@Sun.COM 	ddi_acc_handle_t	buf_acch;
6410463SGarrett.Damore@Sun.COM 	uint32_t		buf_paddr;
6510463SGarrett.Damore@Sun.COM 	caddr_t			buf_kaddr;
6610463SGarrett.Damore@Sun.COM 	size_t			buf_size;
6710463SGarrett.Damore@Sun.COM 	uint32_t		buf_frames;
6810463SGarrett.Damore@Sun.COM 	int			syncdir;
6910463SGarrett.Damore@Sun.COM 	int			nchan;
7010463SGarrett.Damore@Sun.COM 	uint64_t		count;
7110463SGarrett.Damore@Sun.COM 	uint32_t		offset;
7210463SGarrett.Damore@Sun.COM };
7310463SGarrett.Damore@Sun.COM 
7410463SGarrett.Damore@Sun.COM struct _p16x_dev_t
7510463SGarrett.Damore@Sun.COM {
7610463SGarrett.Damore@Sun.COM 	dev_info_t		*dip;
7710463SGarrett.Damore@Sun.COM 	audio_dev_t		*adev;
7810463SGarrett.Damore@Sun.COM 	ac97_t			*ac97;
7910463SGarrett.Damore@Sun.COM 	boolean_t		suspended;
8010463SGarrett.Damore@Sun.COM 	ddi_acc_handle_t	pcih;
8110463SGarrett.Damore@Sun.COM 	ddi_acc_handle_t	regsh;
8210463SGarrett.Damore@Sun.COM 	caddr_t			base;
83*11936Sgdamore@opensolaris.org 	kmutex_t		mutex;	/* For low level routines */
8410463SGarrett.Damore@Sun.COM 
8510463SGarrett.Damore@Sun.COM 	p16x_port_t 		*port[P16X_NUM_PORT];
8610463SGarrett.Damore@Sun.COM };
8710463SGarrett.Damore@Sun.COM 
8810463SGarrett.Damore@Sun.COM #define	INL(dev, reg)	\
8910463SGarrett.Damore@Sun.COM 	ddi_get32(dev->regsh, (void *)((char *)dev->base+(reg)))
9010463SGarrett.Damore@Sun.COM #define	INW(dev, reg)	\
9110463SGarrett.Damore@Sun.COM 	ddi_get16(dev->regsh, (void *)((char *)dev->base+(reg)))
9210463SGarrett.Damore@Sun.COM #define	INB(dev, reg)	\
9310463SGarrett.Damore@Sun.COM 	ddi_get8(dev->regsh, (void *)((char *)dev->base+(reg)))
9410463SGarrett.Damore@Sun.COM 
9510463SGarrett.Damore@Sun.COM #define	OUTL(dev, val, reg)	\
9610463SGarrett.Damore@Sun.COM 	ddi_put32(dev->regsh, (void *)((char *)dev->base+(reg)), (val))
9710463SGarrett.Damore@Sun.COM #define	OUTW(dev, val, reg)	\
9810463SGarrett.Damore@Sun.COM 	ddi_put16(dev->regsh, (void *)((char *)dev->base+(reg)), (val))
9910463SGarrett.Damore@Sun.COM #define	OUTB(dev, val, reg)	\
10010463SGarrett.Damore@Sun.COM 	ddi_put8(dev->regsh, (void *)((char *)dev->base+(reg)), (val))
10110463SGarrett.Damore@Sun.COM 
10210463SGarrett.Damore@Sun.COM /*
10310463SGarrett.Damore@Sun.COM  * SB P16X Registers
10410463SGarrett.Damore@Sun.COM  */
10510463SGarrett.Damore@Sun.COM 
10610463SGarrett.Damore@Sun.COM #define	PTR 	0x00
10710463SGarrett.Damore@Sun.COM #define	DR	0x04
10810463SGarrett.Damore@Sun.COM #define	IP	0x08
10910463SGarrett.Damore@Sun.COM #define	IE	0x0C
11010463SGarrett.Damore@Sun.COM #define	HC	0x14
11110463SGarrett.Damore@Sun.COM #define	GPIO	0x18
11210463SGarrett.Damore@Sun.COM #define	AC97D	0x1C
11310463SGarrett.Damore@Sun.COM #define	AC97A	0x1E
11410463SGarrett.Damore@Sun.COM 
11510463SGarrett.Damore@Sun.COM /*
11610463SGarrett.Damore@Sun.COM  * Indirect registers
11710463SGarrett.Damore@Sun.COM  */
11810463SGarrett.Damore@Sun.COM 
11910463SGarrett.Damore@Sun.COM #define	PTBA	0x000
12010463SGarrett.Damore@Sun.COM #define	PTBS	0x001
12110463SGarrett.Damore@Sun.COM #define	PTCA	0x002
12210463SGarrett.Damore@Sun.COM #define	PFBA	0x004
12310463SGarrett.Damore@Sun.COM #define	PFBS	0x005
12410463SGarrett.Damore@Sun.COM #define	CPFA	0x006
12510463SGarrett.Damore@Sun.COM #define	PFEA	0x007
12610463SGarrett.Damore@Sun.COM #define	CPCAV	0x008
12710463SGarrett.Damore@Sun.COM #define	RFBA	0x010
12810463SGarrett.Damore@Sun.COM #define	RFBS	0x011
12910463SGarrett.Damore@Sun.COM #define	CRFA	0x012
13010463SGarrett.Damore@Sun.COM #define	CRCAV	0x013
13110463SGarrett.Damore@Sun.COM #define	CDL	0x020
13210463SGarrett.Damore@Sun.COM #define	CDR	0x030
13310463SGarrett.Damore@Sun.COM #define	SA	0x040
13410463SGarrett.Damore@Sun.COM #define	EA_aux	0x041
13510463SGarrett.Damore@Sun.COM #define	SCS0	0x042
13610463SGarrett.Damore@Sun.COM #define	SCS1	0x043
13710463SGarrett.Damore@Sun.COM #define	SCS2	0x044
13810463SGarrett.Damore@Sun.COM #define	SPC	0x045
13910463SGarrett.Damore@Sun.COM #define	WMARK	0x046
14010463SGarrett.Damore@Sun.COM #define	MUDAT	0x047
14110463SGarrett.Damore@Sun.COM #define	MUCMD	0x048
14210463SGarrett.Damore@Sun.COM #define	RCD	0x050
14310463SGarrett.Damore@Sun.COM 
14410463SGarrett.Damore@Sun.COM /*
14510463SGarrett.Damore@Sun.COM  * Interrupt bits
14610463SGarrett.Damore@Sun.COM  */
14710463SGarrett.Damore@Sun.COM 
14810463SGarrett.Damore@Sun.COM #define	INTR_RFF	(1<<19)
14910463SGarrett.Damore@Sun.COM #define	INTR_RFH	(1<<16)
15010463SGarrett.Damore@Sun.COM #define	INTR_PFF	(3<<11)
15110463SGarrett.Damore@Sun.COM #define	INTR_PFH	(3<<8)
15210463SGarrett.Damore@Sun.COM #define	INTR_EAI	(1<<29)
15310463SGarrett.Damore@Sun.COM #define	INTR_PCI	1
15410463SGarrett.Damore@Sun.COM #define	INTR_UART_RX	2
15510463SGarrett.Damore@Sun.COM #define	INTR_UART_TX	4
15610463SGarrett.Damore@Sun.COM #define	INTR_AC97	0x10
15710463SGarrett.Damore@Sun.COM #define	INTR_GPIO	0x40
15810463SGarrett.Damore@Sun.COM #define	INTR_PLAY	(INTR_PFF | INTR_PFH)
15910463SGarrett.Damore@Sun.COM #define	INTR_REC	(INTR_RFF | INTR_RFH)
16010463SGarrett.Damore@Sun.COM #define	INTR_ALL	(INTR_PLAY | INTR_REC | INTR_PCI)
16110463SGarrett.Damore@Sun.COM 
16210463SGarrett.Damore@Sun.COM #endif /* AUDIOP16X_H */
163