Add a driver for the S3 SonicVibes chip. From OpenBSD and
Constantine Paul Sapuntzakis (csapuntz@cvs.openbsd.org) with some changes by me. XXX The driver still needs work.
This commit is contained in:
parent
5fb70e2fcc
commit
b94cb7b768
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.pci,v 1.49 1998/11/04 00:31:05 fvdl Exp $
|
||||
# $NetBSD: files.pci,v 1.50 1998/12/10 18:47:18 augustss Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent PCI code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
@ -133,6 +133,14 @@ device eap: audio, auconv, mulaw
|
||||
attach eap at pci
|
||||
file dev/pci/eap.c eap
|
||||
|
||||
# S3 SonicVibes (S3 617)
|
||||
device sv { }: audio, auconv, mulaw, midibus
|
||||
attach sv at pci
|
||||
file dev/pci/sv.c sv
|
||||
|
||||
attach opl at sv with opl_sv
|
||||
file dev/pci/opl_sv.c opl_sv
|
||||
|
||||
# SMC EPIC/100 Fast Ethernet on PCI
|
||||
attach epic at pci with epic_pci
|
||||
file dev/pci/if_epic_pci.c epic_pci
|
||||
|
100
sys/dev/pci/opl_sv.c
Normal file
100
sys/dev/pci/opl_sv.c
Normal file
@ -0,0 +1,100 @@
|
||||
/* $NetBSD: opl_sv.c,v 1.1 1998/12/10 18:47:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Lennart Augustsson (augustss@netbsd.org).
|
||||
*
|
||||
* 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. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/audioio.h>
|
||||
#include <sys/midiio.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/audio_if.h>
|
||||
#include <dev/midi_if.h>
|
||||
#include <dev/ic/oplreg.h>
|
||||
#include <dev/ic/oplvar.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <dev/pci/svvar.h>
|
||||
|
||||
int opl_sv_match __P((struct device *, struct cfdata *, void *));
|
||||
void opl_sv_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach opl_sv_ca = {
|
||||
sizeof (struct opl_softc), opl_sv_match, opl_sv_attach
|
||||
};
|
||||
|
||||
int
|
||||
opl_sv_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct audio_attach_args *aa = (struct audio_attach_args *)aux;
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_OPL)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
opl_sv_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct sv_softc *ssc = (struct sv_softc *)parent;
|
||||
struct opl_softc *sc = (struct opl_softc *)self;
|
||||
|
||||
sc->ioh = ssc->sc_oplioh;
|
||||
sc->iot = ssc->sc_opliot;
|
||||
sc->offs = 0;
|
||||
strcpy(sc->syn.name, "SV ");
|
||||
/*sc->spkrctl = 0;
|
||||
sc->spkrarg = 0;*/
|
||||
|
||||
opl_attach(sc);
|
||||
}
|
1443
sys/dev/pci/sv.c
Normal file
1443
sys/dev/pci/sv.c
Normal file
File diff suppressed because it is too large
Load Diff
235
sys/dev/pci/svreg.h
Normal file
235
sys/dev/pci/svreg.h
Normal file
@ -0,0 +1,235 @@
|
||||
/* $NetBSD: svreg.h,v 1.1 1998/12/10 18:47:19 augustss Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1998 Constantine Paul Sapuntzakis
|
||||
* All rights reserved
|
||||
*
|
||||
* Author: Constantine Paul Sapuntzakis (csapuntz@cvs.openbsd.org)
|
||||
*
|
||||
* 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. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The author's name or those of the 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(S) AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PCI BIOS Configuration area ports
|
||||
*/
|
||||
|
||||
enum {
|
||||
SV_SB_PORTBASE_SLOT = 0x10,
|
||||
SV_ENHANCED_PORTBASE_SLOT = 0x14,
|
||||
SV_FM_PORTBASE_SLOT = 0x18,
|
||||
SV_MIDI_PORTBASE_SLOT = 0x1c,
|
||||
SV_GAME_PORTBASE_SLOT = 0x20
|
||||
};
|
||||
|
||||
/*
|
||||
* Enhanced CODEC registers
|
||||
* These are offset from the base specified in the PCI configuration area
|
||||
*/
|
||||
enum {
|
||||
SV_CODEC_CONTROL = 0,
|
||||
SV_CODEC_INTMASK = 1,
|
||||
SV_CODEC_STATUS = 2,
|
||||
SV_CODEC_IADDR = 4,
|
||||
SV_CODEC_IDATA = 5
|
||||
};
|
||||
|
||||
/*
|
||||
* DMA Configuration register
|
||||
*/
|
||||
|
||||
enum {
|
||||
SV_DMAA_CONFIG_OFF = 0x40,
|
||||
SV_DMAC_CONFIG_OFF = 0x48
|
||||
};
|
||||
#define SV_DMAA_SIZE 0x10
|
||||
#define SV_DMAA_ALIGN 0x10
|
||||
#define SV_DMAC_SIZE 0x10
|
||||
#define SV_DMAC_ALIGN 0x10
|
||||
|
||||
enum {
|
||||
SV_DMA_CHANNEL_ENABLE = 0x1,
|
||||
SV_DMAA_EXTENDED_ADDR = 0x8,
|
||||
SV_DMA_PORTBASE_MASK = 0xFFFFFFF0
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
SV_DMA_ADDR0 = 0,
|
||||
SV_DMA_ADDR1 = 1,
|
||||
SV_DMA_ADDR2 = 2,
|
||||
SV_DMA_ADDR3 = 3,
|
||||
SV_DMA_COUNT0 = 4,
|
||||
SV_DMA_COUNT1 = 5,
|
||||
SV_DMA_COUNT2 = 6,
|
||||
SV_DMA_CMDSTATUS = 8,
|
||||
SV_DMA_MODE = 0xB,
|
||||
SV_DMA_MASTERCLEAR = 0xD,
|
||||
SV_DMA_MASK = 0xF
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* DMA Mode (see reg 0xB)
|
||||
*/
|
||||
|
||||
enum {
|
||||
SV_DMA_MODE_IOR_MASK = 0x0C,
|
||||
SV_DMA_MODE_IOW_MASK = 0x0C,
|
||||
SV_DMA_MODE_IOR = 0x04,
|
||||
SV_DMA_MODE_IOW = 0x08,
|
||||
SV_DMA_MODE_AUTOINIT = 0x10
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_CTL_ENHANCED = 0x01,
|
||||
SV_CTL_MD1 = 0x04,
|
||||
SV_CTL_FWS = 0x08,
|
||||
SV_CTL_INTA = 0x20,
|
||||
SV_CTL_RESET = 0x80
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_INTMASK_DMAA = 0x1,
|
||||
SV_INTMASK_DMAC = 0x4,
|
||||
SV_INTMASK_SINT = 0x8,
|
||||
SV_INTMASK_UD = 0x40,
|
||||
SV_INTMASK_MIDI = 0x80
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_INTSTATUS_DMAA = 0x1,
|
||||
SV_INTSTATUS_DMAC = 0x4,
|
||||
SV_INTSTATUS_SINT = 0x8,
|
||||
SV_INTSTATUS_UD = 0x40,
|
||||
SV_INTSTATUS_MIDI = 0x80
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_IADDR_MASK = 0x3f,
|
||||
SV_IADDR_MCE = 0x40,
|
||||
/* TRD = DMA Transfer request disable */
|
||||
SV_IADDR_TRD = 0x80
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
SV_LEFT_ADC_INPUT_CONTROL = 0x0,
|
||||
SV_RIGHT_ADC_INPUT_CONTROL = 0x1,
|
||||
SV_LEFT_AUX1_INPUT_CONTROL = 0x2,
|
||||
SV_RIGHT_AUX1_INPUT_CONTROL = 0x3,
|
||||
SV_LEFT_CD_INPUT_CONTROL = 0x4,
|
||||
SV_RIGHT_CD_INPUT_CONTROL = 0x5,
|
||||
SV_LEFT_LINE_IN_INPUT_CONTROL = 0x6,
|
||||
SV_RIGHT_LINE_IN_INPUT_CONTROL = 0x7,
|
||||
SV_MIC_INPUT_CONTROL = 0x8,
|
||||
SV_GAME_PORT_CONTROL = 0x9,
|
||||
SV_LEFT_SYNTH_INPUT_CONTROL = 0x0A,
|
||||
SV_RIGHT_SYNTH_INPUT_CONTROL = 0x0B,
|
||||
SV_LEFT_AUX2_INPUT_CONTROL = 0x0C,
|
||||
SV_RIGHT_AUX2_INPUT_CONTROL = 0x0D,
|
||||
SV_LEFT_MIXER_OUTPUT_CONTROL = 0x0E,
|
||||
SV_RIGHT_MIXER_OUTPUT_CONTROL = 0x0F,
|
||||
SV_LEFT_PCM_INPUT_CONTROL = 0x10,
|
||||
SV_RIGHT_PCM_INPUT_CONTROL = 0x11,
|
||||
SV_DMA_DATA_FORMAT = 0x12,
|
||||
SV_PLAY_RECORD_ENABLE = 0x13,
|
||||
SV_UP_DOWN_CONTROL = 0x14,
|
||||
SV_REVISION_LEVEL = 0x15,
|
||||
SV_MONITOR_CONTROL = 0x16,
|
||||
SV_DMAA_COUNT1 = 0x18,
|
||||
SV_DMAA_COUNT0 = 0x19,
|
||||
SV_DMAC_COUNT1 = 0x1C,
|
||||
SV_DMAC_COUNT0 = 0x1d,
|
||||
SV_PCM_SAMPLE_RATE_0 = 0x1e,
|
||||
SV_PCM_SAMPLE_RATE_1 = 0x1f,
|
||||
SV_SYNTH_SAMPLE_RATE_0 = 0x20,
|
||||
SV_SYNTH_SAMPLE_RATE_1 = 0x21,
|
||||
SV_ADC_CLOCK_SOURCE = 0x22,
|
||||
SV_ADC_ALT_SAMPLE_RATE = 0x23,
|
||||
SV_ADC_PLL_M = 0x24,
|
||||
SV_ADC_PLL_N = 0x25,
|
||||
SV_SYNTH_PLL_M = 0x26,
|
||||
SV_SYNTH_PLL_N = 0x27,
|
||||
SV_MPU401 = 0x2A,
|
||||
SV_DRIVE_CONTROL = 0x2B,
|
||||
SV_SRS_SPACE_CONTROL = 0x2c,
|
||||
SV_SRS_CENTER_CONTROL = 0x2d,
|
||||
SV_WAVETABLE_SOURCE_SELECT = 0x2e,
|
||||
SV_ANALOG_POWER_DOWN_CONTROL = 0x30,
|
||||
SV_DIGITAL_POWER_DOWN_CONTROL = 0x31
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_MUTE_BIT = 0x80,
|
||||
SV_AUX1_MASK = 0x1F,
|
||||
SV_CD_MASK = 0x1F,
|
||||
SV_LINE_IN_MASK = 0x1F,
|
||||
SV_MIC_MASK = 0x0F,
|
||||
SV_SYNTH_MASK = 0x1F,
|
||||
SV_AUX2_MASK = 0x1F,
|
||||
SV_MIXER_OUT_MASK = 0x1F,
|
||||
SV_PCM_MASK = 0x3F
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_DMAA_STEREO = 0x1,
|
||||
SV_DMAA_FORMAT16 = 0x2,
|
||||
SV_DMAC_STEREO = 0x10,
|
||||
SV_DMAC_FORMAT16 = 0x20
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_PLAY_ENABLE = 0x1,
|
||||
SV_RECORD_ENABLE = 0x2
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_PLL_R_SHIFT = 5
|
||||
};
|
||||
|
||||
/* ADC input source (registers 0 & 1) */
|
||||
enum {
|
||||
SV_REC_SOURCE_MASK = 0xE0,
|
||||
SV_REC_SOURCE_SHIFT = 5,
|
||||
SV_MIC_BOOST_BIT = 0x10,
|
||||
SV_REC_GAIN_MASK = 0x0F,
|
||||
SV_REC_CD = 1,
|
||||
SV_REC_DAC = 2,
|
||||
SV_REC_AUX2 = 3,
|
||||
SV_REC_LINE = 4,
|
||||
SV_REC_AUX1 = 5,
|
||||
SV_REC_MIC = 6,
|
||||
SV_REC_MIXER = 7
|
||||
};
|
||||
|
||||
/* SRS Space control register (reg 0x2C) */
|
||||
|
||||
enum {
|
||||
SV_SRS_SPACE_ONOFF = 0x80
|
||||
};
|
||||
|
||||
enum {
|
||||
SV_WSS_WT0 = 0x01,
|
||||
SV_WSS_WT1 = 0x02,
|
||||
};
|
64
sys/dev/pci/svvar.h
Normal file
64
sys/dev/pci/svvar.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* $NetBSD: svvar.h,v 1.1 1998/12/10 18:47:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Constantine Paul Sapuntzakis
|
||||
* All rights reserved
|
||||
*
|
||||
* Author: Constantine Paul Sapuntzakis (csapuntz@cvs.openbsd.org)
|
||||
*
|
||||
* 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. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The author's name or those of the 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(S) AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct sv_softc {
|
||||
struct device sc_dev; /* base device */
|
||||
void *sc_ih; /* interrupt vectoring */
|
||||
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
bus_space_handle_t sc_dmaa_ioh;
|
||||
bus_space_handle_t sc_dmac_ioh;
|
||||
bus_dma_tag_t sc_dmatag; /* DMA tag */
|
||||
|
||||
bus_space_tag_t sc_opliot;
|
||||
bus_space_handle_t sc_oplioh;
|
||||
|
||||
bus_space_tag_t sc_midiiot;
|
||||
bus_space_handle_t sc_midiioh;
|
||||
|
||||
struct sv_dma *sc_dmas;
|
||||
|
||||
void (*sc_pintr)(void *); /* dma completion intr handler */
|
||||
void *sc_parg; /* arg for sc_intr() */
|
||||
|
||||
void (*sc_rintr)(void *); /* dma completion intr handler */
|
||||
void *sc_rarg; /* arg for sc_intr() */
|
||||
char sc_enable;
|
||||
|
||||
u_int sc_record_source; /* recording source mask */
|
||||
|
||||
struct pci_attach_args sc_pa;
|
||||
char sc_dmaset;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user