Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys/arch/arm/iomd port to audiomp: get_locks sup...
details: https://anonhg.NetBSD.org/src/rev/bd748e181096
branches: jmcneill-audiomp3
changeset: 771353:bd748e181096
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Nov 20 12:58:45 2011 +0000
description:
port to audiomp: get_locks support, stream filter updates, remove IPL_AUDIO
not run time tested.
diffstat:
sys/arch/arm/iomd/vidcaudio.c | 47 ++++++++++++++++++++++++++++++++----------
1 files changed, 36 insertions(+), 11 deletions(-)
diffs (147 lines):
diff -r c3a563eb5e37 -r bd748e181096 sys/arch/arm/iomd/vidcaudio.c
--- a/sys/arch/arm/iomd/vidcaudio.c Sun Nov 20 12:42:43 2011 +0000
+++ b/sys/arch/arm/iomd/vidcaudio.c Sun Nov 20 12:58:45 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vidcaudio.c,v 1.46 2008/03/01 16:17:47 chris Exp $ */
+/* $NetBSD: vidcaudio.c,v 1.46.40.1 2011/11/20 12:58:45 mrg Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@@ -65,7 +65,7 @@
#include <sys/param.h> /* proc.h */
-__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.46 2008/03/01 16:17:47 chris Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.46.40.1 2011/11/20 12:58:45 mrg Exp $");
#include <sys/audioio.h>
#include <sys/conf.h> /* autoconfig functions */
@@ -120,6 +120,9 @@
void (*sc_pintr)(void *);
void *sc_parg;
int sc_pcountdown;
+
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
};
static int vidcaudio_probe(struct device *, struct cfdata *, void *);
@@ -132,8 +135,9 @@
static void vidcaudio_stereo(int, int);
static stream_filter_factory_t mulaw_to_vidc;
static stream_filter_factory_t mulaw_to_vidc_stereo;
-static int mulaw_to_vidc_fetch_to(stream_fetcher_t *, audio_stream_t *, int);
-static int mulaw_to_vidc_stereo_fetch_to(stream_fetcher_t *,
+static int mulaw_to_vidc_fetch_to(struct audio_softc *, stream_fetcher_t *,
+ audio_stream_t *, int);
+static int mulaw_to_vidc_stereo_fetch_to(struct audio_softc *, stream_fetcher_t *,
audio_stream_t *, int);
CFATTACH_DECL(vidcaudio, sizeof(struct vidcaudio_softc),
@@ -154,6 +158,7 @@
static int vidcaudio_get_port(void *, mixer_ctrl_t *);
static int vidcaudio_query_devinfo(void *, mixer_devinfo_t *);
static int vidcaudio_get_props(void *);
+static void vidcaudio_get_locks(void *, kmutex_t **, kmutex_t **);
static struct audio_device vidcaudio_device = {
"ARM VIDC",
@@ -189,6 +194,8 @@
vidcaudio_trigger_output,
vidcaudio_trigger_input,
NULL,
+ NULL,
+ vidcaudio_get_locks,
};
static int
@@ -240,10 +247,13 @@
else
aprint_normal(": 8-bit internal DAC\n");
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+
/* Install the irq handler for the DMA interrupt */
sc->sc_ih.ih_func = vidcaudio_intr;
sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_AUDIO;
+ sc->sc_ih.ih_level = IPL_SCHED;
sc->sc_ih.ih_name = self->dv_xname;
if (irq_claim(sc->sc_dma_intr, &sc->sc_ih) != 0) {
@@ -322,13 +332,14 @@
}
static int
-mulaw_to_vidc_fetch_to(stream_fetcher_t *self, audio_stream_t *dst, int max_used)
+mulaw_to_vidc_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
+ audio_stream_t *dst, int max_used)
{
stream_filter_t *this;
int m, err;
this = (stream_filter_t *)self;
- if ((err = this->prev->fetch_to(this->prev, this->src, max_used)))
+ if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = dst->end - dst->start;
m = min(m, max_used);
@@ -347,15 +358,15 @@
}
static int
-mulaw_to_vidc_stereo_fetch_to(stream_fetcher_t *self, audio_stream_t *dst,
- int max_used)
+mulaw_to_vidc_stereo_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
+ audio_stream_t *dst, int max_used)
{
stream_filter_t *this;
int m, err;
this = (stream_filter_t *)self;
max_used = (max_used + 1) & ~1;
- if ((err = this->prev->fetch_to(this->prev, this->src, max_used / 2)))
+ if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used / 2)))
return err;
m = (dst->end - dst->start) & ~1;
m = min(m, max_used);
@@ -556,6 +567,15 @@
}
static void
+vidcaudio_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct vidcaudio_softc *sc = opaque;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
+static void
vidcaudio_rate(int rate)
{
@@ -585,10 +605,14 @@
paddr_t pnext, pend;
sc = arg;
+ mutex_spin_enter(&sc->sc_intr_lock);
+
status = IOMD_READ_BYTE(IOMD_SD0ST);
DPRINTF(("I[%x]", status));
- if ((status & IOMD_DMAST_INT) == 0)
+ if ((status & IOMD_DMAST_INT) == 0) {
+ mutex_spin_exit(&sc->sc_intr_lock);
return 0;
+ }
pnext = sc->sc_ppages[sc->sc_poffset >> PGSHIFT] |
(sc->sc_poffset & PGOFSET);
@@ -621,5 +645,6 @@
else
(*sc->sc_pintr)(sc->sc_parg);
+ mutex_spin_exit(&sc->sc_intr_lock);
return 1;
}
Home |
Main Index |
Thread Index |
Old Index