2009-09-18 16:23:16 +04:00
|
|
|
/* $NetBSD: cs4231_sbus.c,v 1.47 2009/09/18 12:23:16 tsutsui Exp $ */
|
1998-08-28 12:58:24 +04:00
|
|
|
|
|
|
|
/*-
|
2007-12-03 18:33:00 +03:00
|
|
|
* Copyright (c) 1998, 1999, 2002, 2007 The NetBSD Foundation, Inc.
|
1998-08-28 12:58:24 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Kranenburg.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2001-11-13 09:54:32 +03:00
|
|
|
#include <sys/cdefs.h>
|
2009-09-18 16:23:16 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.47 2009/09/18 12:23:16 tsutsui Exp $");
|
2001-11-13 09:54:32 +03:00
|
|
|
|
1998-08-28 00:51:17 +04:00
|
|
|
#include "audio.h"
|
|
|
|
#if NAUDIO > 0
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/malloc.h>
|
2007-10-19 15:59:34 +04:00
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/intr.h>
|
2000-07-10 00:57:41 +04:00
|
|
|
|
|
|
|
#include <dev/sbus/sbusvar.h>
|
1998-08-28 00:51:17 +04:00
|
|
|
|
|
|
|
#include <sys/audioio.h>
|
|
|
|
#include <dev/audio_if.h>
|
|
|
|
|
|
|
|
#include <dev/ic/ad1848reg.h>
|
|
|
|
#include <dev/ic/cs4231reg.h>
|
|
|
|
#include <dev/ic/ad1848var.h>
|
1999-06-05 18:29:10 +04:00
|
|
|
#include <dev/ic/cs4231var.h>
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
#include <dev/ic/apcdmareg.h>
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
int cs4231_sbus_debug = 0;
|
|
|
|
#define DPRINTF(x) if (cs4231_sbus_debug) printf x
|
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* where APC DMA registers are located */
|
|
|
|
#define CS4231_APCDMA_OFFSET 16
|
|
|
|
|
|
|
|
/* interrupt enable bits except those specific for playback/capture */
|
|
|
|
#define APC_ENABLE (APC_EI | APC_IE | APC_EIE)
|
|
|
|
|
|
|
|
struct cs4231_sbus_softc {
|
|
|
|
struct cs4231_softc sc_cs4231;
|
|
|
|
|
2007-12-03 18:33:00 +03:00
|
|
|
void *sc_pint;
|
|
|
|
void *sc_rint;
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_tag_t sc_bt; /* DMA controller tag */
|
|
|
|
bus_space_handle_t sc_bh; /* DMA controller registers */
|
2002-03-12 07:48:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-12 18:38:26 +04:00
|
|
|
static int cs4231_sbus_match(device_t, cfdata_t, void *);
|
|
|
|
static void cs4231_sbus_attach(device_t, device_t, void *);
|
2008-04-29 18:46:57 +04:00
|
|
|
static int cs4231_sbus_pint(void *);
|
|
|
|
static int cs4231_sbus_rint(void *);
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2002-10-01 03:07:07 +04:00
|
|
|
CFATTACH_DECL(audiocs_sbus, sizeof(struct cs4231_sbus_softc),
|
2002-10-02 20:51:16 +04:00
|
|
|
cs4231_sbus_match, cs4231_sbus_attach, NULL, NULL);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-05-03 22:10:37 +04:00
|
|
|
/* audio_hw_if methods specific to apc DMA */
|
2002-03-12 07:48:28 +03:00
|
|
|
static int cs4231_sbus_trigger_output(void *, void *, void *, int,
|
|
|
|
void (*)(void *), void *,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
const audio_params_t *);
|
2002-03-12 07:48:28 +03:00
|
|
|
static int cs4231_sbus_trigger_input(void *, void *, void *, int,
|
|
|
|
void (*)(void *), void *,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
const audio_params_t *);
|
2002-03-12 07:48:28 +03:00
|
|
|
static int cs4231_sbus_halt_output(void *);
|
|
|
|
static int cs4231_sbus_halt_input(void *);
|
|
|
|
|
2004-10-29 16:57:15 +04:00
|
|
|
const struct audio_hw_if audiocs_sbus_hw_if = {
|
2002-03-12 07:48:28 +03:00
|
|
|
cs4231_open,
|
|
|
|
cs4231_close,
|
|
|
|
NULL, /* drain */
|
|
|
|
ad1848_query_encoding,
|
|
|
|
ad1848_set_params,
|
2003-09-10 15:45:45 +04:00
|
|
|
NULL, /* round_blocksize */
|
2002-03-12 07:48:28 +03:00
|
|
|
ad1848_commit_settings,
|
|
|
|
NULL, /* init_output */
|
|
|
|
NULL, /* init_input */
|
|
|
|
NULL, /* start_output */
|
|
|
|
NULL, /* start_input */
|
|
|
|
cs4231_sbus_halt_output,
|
|
|
|
cs4231_sbus_halt_input,
|
|
|
|
NULL, /* speaker_ctl */
|
|
|
|
cs4231_getdev,
|
|
|
|
NULL, /* setfd */
|
|
|
|
cs4231_set_port,
|
|
|
|
cs4231_get_port,
|
|
|
|
cs4231_query_devinfo,
|
|
|
|
cs4231_malloc,
|
|
|
|
cs4231_free,
|
2003-09-10 15:45:45 +04:00
|
|
|
NULL, /* round_buffersize */
|
2005-01-15 18:19:51 +03:00
|
|
|
NULL, /* mappage */
|
2002-03-12 07:48:28 +03:00
|
|
|
cs4231_get_props,
|
|
|
|
cs4231_sbus_trigger_output,
|
|
|
|
cs4231_sbus_trigger_input,
|
|
|
|
NULL, /* dev_ioctl */
|
2006-10-15 23:43:45 +04:00
|
|
|
NULL, /* powerstate */
|
2002-03-12 07:48:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
static void cs4231_sbus_regdump(char *, struct cs4231_sbus_softc *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static int cs4231_sbus_intr(void *);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2009-05-12 18:38:26 +04:00
|
|
|
cs4231_sbus_match(device_t parent, cfdata_t cf, void *aux)
|
1998-08-28 00:51:17 +04:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct sbus_attach_args *sa;
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sa = aux;
|
|
|
|
return strcmp(sa->sa_name, AUDIOCS_PROM_NAME) == 0;
|
1998-08-28 00:51:17 +04:00
|
|
|
}
|
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
static void
|
2009-05-12 18:38:26 +04:00
|
|
|
cs4231_sbus_attach(device_t parent, device_t self, void *aux)
|
1998-08-28 00:51:17 +04:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
struct sbus_attach_args *sa;
|
1998-08-28 00:51:17 +04:00
|
|
|
bus_space_handle_t bh;
|
|
|
|
|
2009-09-18 16:23:16 +04:00
|
|
|
sbsc = device_private(self);
|
2005-01-15 18:19:51 +03:00
|
|
|
sc = &sbsc->sc_cs4231;
|
|
|
|
sa = aux;
|
2002-03-21 03:25:41 +03:00
|
|
|
sbsc->sc_bt = sc->sc_bustag = sa->sa_bustag;
|
1998-08-28 00:51:17 +04:00
|
|
|
sc->sc_dmatag = sa->sa_dmatag;
|
|
|
|
|
2008-04-29 18:10:00 +04:00
|
|
|
sbsc->sc_pint = sparc_softintr_establish(IPL_VM,
|
2008-04-29 22:07:11 +04:00
|
|
|
(void *)cs4231_sbus_pint, sc);
|
2008-04-29 18:10:00 +04:00
|
|
|
sbsc->sc_rint = sparc_softintr_establish(IPL_VM,
|
2008-04-29 22:07:11 +04:00
|
|
|
(void *)cs4231_sbus_rint, sc);
|
2007-12-03 18:33:00 +03:00
|
|
|
|
1998-08-28 00:51:17 +04:00
|
|
|
/*
|
|
|
|
* Map my registers in, if they aren't already in virtual
|
|
|
|
* address space.
|
|
|
|
*/
|
|
|
|
if (sa->sa_npromvaddrs) {
|
2002-03-21 03:25:41 +03:00
|
|
|
sbus_promaddr_to_handle(sa->sa_bustag,
|
|
|
|
sa->sa_promvaddrs[0], &bh);
|
1998-08-28 00:51:17 +04:00
|
|
|
} else {
|
2002-03-21 03:25:41 +03:00
|
|
|
if (sbus_bus_map(sa->sa_bustag, sa->sa_slot,
|
|
|
|
sa->sa_offset, sa->sa_size, 0, &bh) != 0) {
|
2008-04-05 22:35:31 +04:00
|
|
|
aprint_error("%s @ sbus: cannot map registers\n",
|
|
|
|
device_xname(self));
|
1998-08-28 00:51:17 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_subregion(sa->sa_bustag, bh, CS4231_APCDMA_OFFSET,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_SIZE, &sbsc->sc_bh);
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
cs4231_common_attach(sc, bh);
|
1998-08-28 00:51:17 +04:00
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
/* Establish interrupt channel */
|
1999-11-21 18:01:50 +03:00
|
|
|
if (sa->sa_nintr)
|
|
|
|
bus_intr_establish(sa->sa_bustag,
|
2007-12-03 18:33:00 +03:00
|
|
|
sa->sa_pri, IPL_SCHED,
|
2002-03-12 07:48:28 +03:00
|
|
|
cs4231_sbus_intr, sbsc);
|
|
|
|
|
2009-09-18 16:23:16 +04:00
|
|
|
audio_attach_mi(&audiocs_sbus_hw_if, sbsc, self);
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
static void
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_regdump(char *label, struct cs4231_sbus_softc *sc)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
|
|
|
char bits[128];
|
|
|
|
|
|
|
|
printf("cs4231regdump(%s): regs:", label);
|
2002-03-21 03:25:41 +03:00
|
|
|
printf("dmapva: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PVA));
|
2002-03-21 03:25:41 +03:00
|
|
|
printf("dmapc: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PC));
|
2002-03-21 03:25:41 +03:00
|
|
|
printf("dmapnva: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PNVA));
|
2002-03-21 03:25:41 +03:00
|
|
|
printf("dmapnc: 0x%x\n",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_PNC));
|
2005-01-15 18:19:51 +03:00
|
|
|
printf("dmacva: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CVA));
|
2005-01-15 18:19:51 +03:00
|
|
|
printf("dmacc: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CC));
|
2005-01-15 18:19:51 +03:00
|
|
|
printf("dmacnva: 0x%x; ",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CNVA));
|
2005-01-15 18:19:51 +03:00
|
|
|
printf("dmacnc: 0x%x\n",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CNC));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2008-12-17 01:35:21 +03:00
|
|
|
snprintb(bits, sizeof(bits), APC_BITS,
|
|
|
|
bus_space_read_4(sc->sc_bh, sc->sc_bh, APC_DMA_CSR));
|
|
|
|
printf("apc_dmacsr=%s\n", bits);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
ad1848_dump_regs(&sc->sc_cs4231.sc_ad1848);
|
|
|
|
}
|
|
|
|
#endif /* AUDIO_DEBUG */
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_trigger_output(void *addr, void *start, void *end, int blksize,
|
|
|
|
void (*intr)(void *), void *arg,
|
|
|
|
const audio_params_t *param)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
struct cs_transfer *t;
|
|
|
|
uint32_t csr;
|
2002-03-12 07:48:28 +03:00
|
|
|
bus_addr_t dmaaddr;
|
|
|
|
bus_size_t dmasize;
|
|
|
|
int ret;
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
char bits[128];
|
|
|
|
#endif
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sbsc = addr;
|
|
|
|
sc = &sbsc->sc_cs4231;
|
|
|
|
t = &sc->sc_playback;
|
2002-03-12 07:48:28 +03:00
|
|
|
ret = cs4231_transfer_init(sc, t, &dmaaddr, &dmasize,
|
|
|
|
start, end, blksize, intr, arg);
|
|
|
|
if (ret != 0)
|
2005-01-15 18:19:51 +03:00
|
|
|
return ret;
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
DPRINTF(("trigger_output: was: %x %d, %x %d\n",
|
2005-01-15 18:19:51 +03:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PVA),
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
/* load first block */
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNVA, dmaaddr);
|
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNC, dmasize);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
DPRINTF(("trigger_output: 1st: %x %d, %x %d\n",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("trigger_output: csr=%s\n", bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
if ((csr & PDMA_GO) == 0 || (csr & APC_PPAUSE) != 0) {
|
|
|
|
int cfg;
|
|
|
|
|
2002-03-21 03:25:41 +03:00
|
|
|
csr &= ~(APC_PPAUSE | APC_PMIE | APC_INTR_MASK);
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-03-21 03:25:41 +03:00
|
|
|
csr &= ~APC_INTR_MASK;
|
2002-03-12 07:48:28 +03:00
|
|
|
csr |= APC_ENABLE | APC_PIE | APC_PMIE | PDMA_GO;
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
ad_write(&sc->sc_ad1848, SP_LOWER_BASE_COUNT, 0xff);
|
|
|
|
ad_write(&sc->sc_ad1848, SP_UPPER_BASE_COUNT, 0xff);
|
|
|
|
|
|
|
|
cfg = ad_read(&sc->sc_ad1848, SP_INTERFACE_CONFIG);
|
|
|
|
ad_write(&sc->sc_ad1848, SP_INTERFACE_CONFIG,
|
|
|
|
(cfg | PLAYBACK_ENABLE));
|
|
|
|
} else {
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("trigger_output: already: csr=%s\n", bits));
|
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* load next block if we can */
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-03-21 03:25:41 +03:00
|
|
|
if (csr & APC_PD) {
|
2002-07-16 15:48:45 +04:00
|
|
|
cs4231_transfer_advance(t, &dmaaddr, &dmasize);
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNVA, dmaaddr);
|
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNC, dmasize);
|
2002-03-21 03:25:41 +03:00
|
|
|
|
2002-07-16 15:48:45 +04:00
|
|
|
DPRINTF(("trigger_output: 2nd: %x %d, %x %d\n",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_PNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
return 0;
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_halt_output(void *addr)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
uint32_t csr;
|
2002-03-12 07:48:28 +03:00
|
|
|
int cfg;
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
char bits[128];
|
|
|
|
#endif
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sbsc = addr;
|
|
|
|
sc = &sbsc->sc_cs4231;
|
2002-03-12 07:48:28 +03:00
|
|
|
sc->sc_playback.t_active = 0;
|
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("halt_output: csr=%s\n", bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
csr &= ~APC_INTR_MASK; /* do not clear interrupts accidentally */
|
|
|
|
csr |= APC_PPAUSE; /* pause playback (let current complete) */
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2005-01-15 18:19:51 +03:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
/* let the curernt transfer complete */
|
|
|
|
if (csr & PDMA_GO)
|
|
|
|
do {
|
2005-01-15 18:19:51 +03:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("halt_output: csr=%s\n", bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
} while ((csr & APC_PM) == 0);
|
1998-08-28 00:51:17 +04:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
cfg = ad_read(&sc->sc_ad1848, SP_INTERFACE_CONFIG);
|
|
|
|
ad_write(&sc->sc_ad1848, SP_INTERFACE_CONFIG,(cfg & ~PLAYBACK_ENABLE));
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
return 0;
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* NB: we don't enable APC_CMIE and won't use APC_CM */
|
|
|
|
static int
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_trigger_input(void *addr, void *start, void *end, int blksize,
|
|
|
|
void (*intr)(void *), void *arg,
|
|
|
|
const audio_params_t *param)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
struct cs_transfer *t;
|
|
|
|
uint32_t csr;
|
2002-03-12 07:48:28 +03:00
|
|
|
bus_addr_t dmaaddr;
|
|
|
|
bus_size_t dmasize;
|
|
|
|
int ret;
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
char bits[128];
|
|
|
|
#endif
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sbsc = addr;
|
|
|
|
sc = &sbsc->sc_cs4231;
|
|
|
|
t = &sc->sc_capture;
|
2002-03-12 07:48:28 +03:00
|
|
|
ret = cs4231_transfer_init(sc, t, &dmaaddr, &dmasize,
|
|
|
|
start, end, blksize, intr, arg);
|
|
|
|
if (ret != 0)
|
2005-01-15 18:19:51 +03:00
|
|
|
return ret;
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("trigger_input: csr=%s\n", bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
DPRINTF(("trigger_input: was: %x %d, %x %d\n",
|
2005-01-15 18:19:51 +03:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CVA),
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
/* supply first block */
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNVA, dmaaddr);
|
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNC, dmasize);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
DPRINTF(("trigger_input: 1st: %x %d, %x %d\n",
|
2005-01-15 18:19:51 +03:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CVA),
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-03-12 07:48:28 +03:00
|
|
|
if ((csr & CDMA_GO) == 0 || (csr & APC_CPAUSE) != 0) {
|
|
|
|
int cfg;
|
|
|
|
|
2002-03-21 03:25:41 +03:00
|
|
|
csr &= ~(APC_CPAUSE | APC_CMIE | APC_INTR_MASK);
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-03-21 03:25:41 +03:00
|
|
|
csr &= ~APC_INTR_MASK;
|
2002-03-12 07:48:28 +03:00
|
|
|
csr |= APC_ENABLE | APC_CIE | CDMA_GO;
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
ad_write(&sc->sc_ad1848, CS_LOWER_REC_CNT, 0xff);
|
|
|
|
ad_write(&sc->sc_ad1848, CS_UPPER_REC_CNT, 0xff);
|
|
|
|
|
|
|
|
cfg = ad_read(&sc->sc_ad1848, SP_INTERFACE_CONFIG);
|
|
|
|
ad_write(&sc->sc_ad1848, SP_INTERFACE_CONFIG,
|
|
|
|
(cfg | CAPTURE_ENABLE));
|
|
|
|
} else {
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("trigger_input: already: csr=%s\n", bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* supply next block if we can */
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-07-16 15:48:45 +04:00
|
|
|
if (csr & APC_CD) {
|
|
|
|
cs4231_transfer_advance(t, &dmaaddr, &dmasize);
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNVA, dmaaddr);
|
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNC, dmasize);
|
2002-07-16 15:48:45 +04:00
|
|
|
DPRINTF(("trigger_input: 2nd: %x %d, %x %d\n",
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CC),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNVA),
|
|
|
|
bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CNC)));
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
return 0;
|
1998-08-28 00:51:17 +04:00
|
|
|
}
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_halt_input(void *addr)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
uint32_t csr;
|
2002-03-12 07:48:28 +03:00
|
|
|
int cfg;
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
char bits[128];
|
1998-08-28 00:51:17 +04:00
|
|
|
#endif
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sbsc = addr;
|
|
|
|
sc = &sbsc->sc_cs4231;
|
2002-03-12 07:48:28 +03:00
|
|
|
sc->sc_capture.t_active = 0;
|
|
|
|
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("halt_input: csr=%s\n", bits));
|
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
csr &= ~APC_INTR_MASK; /* do not clear interrupts accidentally */
|
|
|
|
csr |= APC_CPAUSE;
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
/* let the curernt transfer complete */
|
|
|
|
if (csr & CDMA_GO)
|
|
|
|
do {
|
2002-03-21 03:25:41 +03:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_CSR);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
#endif
|
|
|
|
DPRINTF(("halt_input: csr=%s\n", bits));
|
|
|
|
|
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
} while ((csr & APC_CM) == 0);
|
|
|
|
|
|
|
|
cfg = ad_read(&sc->sc_ad1848, SP_INTERFACE_CONFIG);
|
|
|
|
ad_write(&sc->sc_ad1848, SP_INTERFACE_CONFIG, (cfg & ~CAPTURE_ENABLE));
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
return 0;
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-01-15 18:19:51 +03:00
|
|
|
cs4231_sbus_intr(void *arg)
|
2002-03-12 07:48:28 +03:00
|
|
|
{
|
2005-01-15 18:19:51 +03:00
|
|
|
struct cs4231_sbus_softc *sbsc;
|
|
|
|
struct cs4231_softc *sc;
|
|
|
|
uint32_t csr;
|
2002-03-12 07:48:28 +03:00
|
|
|
int status;
|
|
|
|
bus_addr_t dmaaddr;
|
|
|
|
bus_size_t dmasize;
|
|
|
|
int served;
|
|
|
|
#if defined(AUDIO_DEBUG) || defined(DIAGNOSTIC)
|
|
|
|
char bits[128];
|
|
|
|
#endif
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
sbsc = arg;
|
|
|
|
sc = &sbsc->sc_cs4231;
|
2003-09-10 15:45:45 +04:00
|
|
|
csr = bus_space_read_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR);
|
2002-03-12 07:48:28 +03:00
|
|
|
if ((csr & APC_INTR_MASK) == 0) /* any interrupt pedning? */
|
2005-01-15 18:19:51 +03:00
|
|
|
return 0;
|
2002-03-12 07:48:28 +03:00
|
|
|
|
2002-03-21 03:25:41 +03:00
|
|
|
/* write back DMA status to clear interrupt */
|
2003-09-10 15:45:45 +04:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh, APC_DMA_CSR, csr);
|
2002-03-12 07:48:28 +03:00
|
|
|
++sc->sc_intrcnt.ev_count;
|
|
|
|
served = 0;
|
|
|
|
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
if (cs4231_sbus_debug > 1)
|
|
|
|
cs4231_sbus_regdump("audiointr", sbsc);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
status = ADREAD(&sc->sc_ad1848, AD1848_STATUS);
|
2008-12-17 01:35:21 +03:00
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
snprintb(bits, sizeof(bits), AD_R2_BITS, status);
|
|
|
|
#endif
|
2008-04-05 22:35:31 +04:00
|
|
|
DPRINTF(("%s: status: %s\n", device_xname(&sc->sc_ad1848.sc_dev),
|
2008-12-17 01:35:21 +03:00
|
|
|
bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
if (status & INTERRUPT_STATUS) {
|
|
|
|
#ifdef AUDIO_DEBUG
|
|
|
|
int reason;
|
|
|
|
|
|
|
|
reason = ad_read(&sc->sc_ad1848, CS_IRQ_STATUS);
|
2008-12-17 01:35:21 +03:00
|
|
|
snprintb(bits, sizeof(bits), CS_I24_BITS, reason);
|
2008-04-05 22:35:31 +04:00
|
|
|
DPRINTF(("%s: i24: %s\n", device_xname(&sc->sc_ad1848.sc_dev),
|
2008-12-17 01:35:21 +03:00
|
|
|
bits));
|
2002-03-12 07:48:28 +03:00
|
|
|
#endif
|
|
|
|
/* clear ad1848 interrupt */
|
|
|
|
ADWRITE(&sc->sc_ad1848, AD1848_STATUS, 0);
|
|
|
|
}
|
2005-01-15 18:19:51 +03:00
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
if (csr & APC_CI) {
|
|
|
|
if (csr & APC_CD) { /* can supply new block */
|
|
|
|
struct cs_transfer *t = &sc->sc_capture;
|
|
|
|
|
|
|
|
cs4231_transfer_advance(t, &dmaaddr, &dmasize);
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_CNVA, dmaaddr);
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_CNC, dmasize);
|
2002-03-12 07:48:28 +03:00
|
|
|
|
|
|
|
if (t->t_intr != NULL)
|
2008-04-29 18:10:00 +04:00
|
|
|
sparc_softintr_schedule(sbsc->sc_rint);
|
2002-03-12 07:48:28 +03:00
|
|
|
++t->t_intrcnt.ev_count;
|
|
|
|
served = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (csr & APC_PMI) {
|
|
|
|
if (!sc->sc_playback.t_active)
|
|
|
|
served = 1; /* draining in halt_output() */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (csr & APC_PI) {
|
|
|
|
if (csr & APC_PD) { /* can load new block */
|
|
|
|
struct cs_transfer *t = &sc->sc_playback;
|
|
|
|
|
|
|
|
if (t->t_active) {
|
|
|
|
cs4231_transfer_advance(t, &dmaaddr, &dmasize);
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_PNVA, dmaaddr);
|
2002-03-21 03:25:41 +03:00
|
|
|
bus_space_write_4(sbsc->sc_bt, sbsc->sc_bh,
|
2003-09-10 15:45:45 +04:00
|
|
|
APC_DMA_PNC, dmasize);
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t->t_intr != NULL)
|
2008-04-29 18:10:00 +04:00
|
|
|
sparc_softintr_schedule(sbsc->sc_pint);
|
2002-03-12 07:48:28 +03:00
|
|
|
++t->t_intrcnt.ev_count;
|
|
|
|
served = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* got an interrupt we don't know how to handle */
|
|
|
|
if (!served) {
|
|
|
|
#ifdef DIAGNOSTIC
|
2008-12-17 01:35:21 +03:00
|
|
|
snprintb(bits, sizeof(bits), APC_BITS, csr);
|
|
|
|
printf("%s: unhandled csr=%s\n",
|
|
|
|
device_xname(&sc->sc_ad1848.sc_dev), bits);
|
2002-03-12 07:48:28 +03:00
|
|
|
#endif
|
|
|
|
/* evcnt? */
|
|
|
|
}
|
|
|
|
|
2005-01-15 18:19:51 +03:00
|
|
|
return 1;
|
2002-03-12 07:48:28 +03:00
|
|
|
}
|
|
|
|
|
2008-04-29 18:46:57 +04:00
|
|
|
static int
|
2007-12-03 18:33:00 +03:00
|
|
|
cs4231_sbus_pint(void *cookie)
|
|
|
|
{
|
|
|
|
struct cs4231_softc *sc = cookie;
|
2008-04-29 18:10:00 +04:00
|
|
|
struct cs_transfer *t;
|
2007-12-03 18:33:00 +03:00
|
|
|
|
2008-04-29 18:10:00 +04:00
|
|
|
KERNEL_LOCK(1, NULL);
|
|
|
|
t = &sc->sc_playback;
|
2007-12-03 18:33:00 +03:00
|
|
|
if (t->t_intr != NULL)
|
|
|
|
(*t->t_intr)(t->t_arg);
|
2008-04-29 18:10:00 +04:00
|
|
|
KERNEL_UNLOCK_ONE(NULL);
|
2008-04-29 18:46:57 +04:00
|
|
|
return 0;
|
2007-12-03 18:33:00 +03:00
|
|
|
}
|
|
|
|
|
2008-04-29 18:46:57 +04:00
|
|
|
static int
|
2007-12-03 18:33:00 +03:00
|
|
|
cs4231_sbus_rint(void *cookie)
|
|
|
|
{
|
|
|
|
struct cs4231_softc *sc = cookie;
|
2008-04-29 18:10:00 +04:00
|
|
|
struct cs_transfer *t;
|
2007-12-03 18:33:00 +03:00
|
|
|
|
2008-04-29 18:10:00 +04:00
|
|
|
KERNEL_LOCK(1, NULL);
|
|
|
|
t = &sc->sc_capture;
|
2007-12-03 18:33:00 +03:00
|
|
|
if (t->t_intr != NULL)
|
|
|
|
(*t->t_intr)(t->t_arg);
|
2008-04-29 18:10:00 +04:00
|
|
|
KERNEL_UNLOCK_ONE(NULL);
|
2008-04-29 18:46:57 +04:00
|
|
|
return 0;
|
2007-12-03 18:33:00 +03:00
|
|
|
}
|
|
|
|
|
2002-03-12 07:48:28 +03:00
|
|
|
#endif /* NAUDIO > 0 */
|