1139749Simp/*-
275885Sorion * Copyright (c) 2001 Orion Hodson <O.Hodson@cs.ucl.ac.uk>
375885Sorion * All rights reserved.
475885Sorion *
575885Sorion * Redistribution and use in source and binary forms, with or without
675885Sorion * modification, are permitted provided that the following conditions
775885Sorion * are met:
875885Sorion * 1. Redistributions of source code must retain the above copyright
975885Sorion *    notice, this list of conditions and the following disclaimer.
1075885Sorion * 2. Redistributions in binary form must reproduce the above copyright
1175885Sorion *    notice, this list of conditions and the following disclaimer in the
1275885Sorion *    documentation and/or other materials provided with the distribution.
1375885Sorion *
1475885Sorion * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1575885Sorion * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1675885Sorion * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1775885Sorion * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1875885Sorion * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1975885Sorion * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2075885Sorion * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2175885Sorion * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
2275885Sorion * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2375885Sorion * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
2475885Sorion * SUCH DAMAGE.
2575885Sorion *
2675885Sorion * $FreeBSD$
2775885Sorion */
2875885Sorion
2975885Sorion#define ALS_PCI_ID0 		0x40004005
3075885Sorion#define ALS_PCI_POWERREG	0xe0
3175885Sorion
3275885Sorion#define ALS_CONFIG_SPACE_BYTES	128
3375885Sorion
3475885Sorion#define ALS_GCR_DATA		0x08
3575885Sorion#define ALS_GCR_INDEX		0x0c
3675885Sorion#	define ALS_GCR_MISC		0x8c
3775885Sorion#	define ALS_GCR_TEST		0x90
3875885Sorion#	define ALS_GCR_DMA0_START	0x91
3975885Sorion#	define ALS_GCR_DMA0_MODE	0x92
4075885Sorion#	define ALS_GCR_DMA1_START	0x93
4175885Sorion#	define ALS_GCR_DMA1_MODE	0x94
4275885Sorion#	define ALS_GCR_DMA3_START	0x95
4375885Sorion#	define ALS_GCR_DMA3_MODE	0x96
4475885Sorion#	define ALS_GCR_DMA_EMULATION	0x99
4575885Sorion#	define ALS_GCR_FIFO0_CURRENT	0xa0
4675885Sorion#	define ALS_GCR_FIFO0_STATUS	0xa1
4775885Sorion#	define ALS_GCR_FIFO1_START	0xa2
4875885Sorion#	define ALS_GCR_FIFO1_COUNT	0xa3
4975885Sorion#	define ALS_GCR_FIFO1_CURRENT	0xa4
5075885Sorion#	define ALS_GCR_FIFO1_STATUS	0xa5
5175885Sorion#	define ALS_GCR_POWER		0xa6
5275885Sorion#	define ALS_GCR_PIC_ACCESS	0xa7
5375885Sorion
5475885Sorion#define ALS_SB_MPU_IRQ		0x0e
5575885Sorion
5675885Sorion#define ALS_MIXER_DATA		0x15
5775885Sorion#define ALS_MIXER_INDEX		0x14
5875885Sorion#	define ALS_SB16_RESET		0x00
5975885Sorion#	define ALS_SB16_DMA_SETUP	0x81
6075885Sorion#	define ALS_CONTROL		0xc0
6175885Sorion#	define ALS_SB16_CONFIG		ALS_CONTROL + 0x00
6275885Sorion#	define ALS_MISC_CONTROL		ALS_CONTROL + 0x02
6375885Sorion#	define ALS_FIFO1_LENGTH_LO	ALS_CONTROL + 0x1c
6475885Sorion#	define ALS_FIFO1_LENGTH_HI	ALS_CONTROL + 0x1d
6575885Sorion#	define ALS_FIFO1_CONTROL	ALS_CONTROL + 0x1e
6675885Sorion#		define ALS_FIFO1_STOP		0x00
6775885Sorion#		define ALS_FIFO1_RUN		0x80
6875885Sorion#		define ALS_FIFO1_PAUSE		0x40
6975885Sorion#		define ALS_FIFO1_STEREO		0x20
7075885Sorion#		define ALS_FIFO1_SIGNED		0x10
7175885Sorion#		define ALS_FIFO1_8BIT		0x04
7275885Sorion
7375885Sorion#define ALS_ESP_RST		0x16
7475885Sorion#define ALS_CR1E_ACK_PORT	0x16
7575885Sorion
7675885Sorion#define ALS_ESP_RD_DATA		0x1a
7775885Sorion#define ALS_ESP_WR_DATA		0x1c
7875885Sorion#define ALS_ESP_WR_STATUS	0x1c
7975885Sorion#define ALS_ESP_RD_STATUS8	0x1e
8075885Sorion#define ALS_ESP_RD_STATUS16	0x1f
8175885Sorion#	define ALS_ESP_SAMPLE_RATE	0x41
8275885Sorion
8375885Sorion#define ALS_MIDI_DATA		0x30
8475885Sorion#define ALS_MIDI_STATUS		0x31
8575885Sorion
8675885Sorion/* Interrupt masks */
8775885Sorion#define	ALS_IRQ_STATUS8		0x01
8875885Sorion#define	ALS_IRQ_STATUS16	0x02
8975885Sorion#define ALS_IRQ_MPUIN		0x04
9075885Sorion#define ALS_IRQ_CR1E		0x20
9175885Sorion
9275885Sorion/* Sample Rate Locks */
9375885Sorion#define ALS_RATE_LOCK_PLAYBACK	0x01
9475885Sorion#define ALS_RATE_LOCK_CAPTURE	0x02
9575885Sorion#define ALS_RATE_LOCK		0x03
96