Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys/arch/hpcmips/vr adapt to audiomp api changes
details: https://anonhg.NetBSD.org/src/rev/a63a16ca30c5
branches: jmcneill-audiomp3
changeset: 771362:a63a16ca30c5
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 20 14:26:34 2011 +0000
description:
adapt to audiomp api changes
diffstat:
sys/arch/hpcmips/vr/vraiu.c | 43 +++++++++++++++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 8 deletions(-)
diffs (141 lines):
diff -r bee3a7e72522 -r a63a16ca30c5 sys/arch/hpcmips/vr/vraiu.c
--- a/sys/arch/hpcmips/vr/vraiu.c Sun Nov 20 14:16:55 2011 +0000
+++ b/sys/arch/hpcmips/vr/vraiu.c Sun Nov 20 14:26:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vraiu.c,v 1.12 2007/03/04 05:59:54 christos Exp $ */
+/* $NetBSD: vraiu.c,v 1.12.80.1 2011/11/20 14:26:34 jmcneill Exp $ */
/*
* Copyright (c) 2001 HAMAJIMA Katsuomi. All rights reserved.
@@ -26,12 +26,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vraiu.c,v 1.12 2007/03/04 05:59:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vraiu.c,v 1.12.80.1 2011/11/20 14:26:34 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/bswap.h>
#include <machine/cpu.h>
@@ -61,6 +60,8 @@
struct vraiu_softc {
struct device sc_dev;
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_dma_tag_t sc_dmat;
@@ -116,6 +117,7 @@
int vraiu_set_params(void *, int, int, audio_params_t *, audio_params_t *,
stream_filter_list_t *, stream_filter_list_t *);
int vraiu_get_props(void *);
+void vraiu_get_locks(void *, kmutex_t **, kmutex_t **);
const struct audio_hw_if vraiu_hw_if = {
vraiu_open,
@@ -142,6 +144,11 @@
NULL,
NULL,
vraiu_get_props,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ vraiu_get_locks,
};
/*
@@ -187,6 +194,8 @@
sc->sc_ac = va->va_ac;
sc->sc_dmat = &vrdcu_bus_dma_tag;
sc->sc_volume = 127;
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
if (!sc->sc_cc) {
printf(" not configured: cmu not found\n");
@@ -208,7 +217,7 @@
/* install interrupt handler and enable interrupt */
if (!(sc->sc_handler = vrip_intr_establish(va->va_vc, va->va_unit,
- 0, IPL_AUDIO, vraiu_intr, sc))) {
+ 0, IPL_SCHED, vraiu_intr, sc))) {
printf(": can't map interrupt line.\n");
return;
}
@@ -221,19 +230,19 @@
AIUINT_INTSIDLE), 0);
if (bus_dmamem_alloc(sc->sc_dmat, AUDIO_BUF_SIZE, 0, 0, &segs, 1,
- &rsegs, BUS_DMA_NOWAIT)) {
+ &rsegs, BUS_DMA_WAITOK)) {
printf(": can't allocate memory.\n");
return;
}
if (bus_dmamem_map(sc->sc_dmat, &segs, rsegs, AUDIO_BUF_SIZE,
(void **)&sc->sc_buf,
- BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) {
+ BUS_DMA_WAITOK | BUS_DMA_COHERENT)) {
printf(": can't map memory.\n");
bus_dmamem_free(sc->sc_dmat, &segs, rsegs);
return;
}
if (bus_dmamap_create(sc->sc_dmat, AUDIO_BUF_SIZE, 1, AUDIO_BUF_SIZE,
- 0, BUS_DMA_NOWAIT, &sc->sc_dmap)) {
+ 0, BUS_DMA_WAITOK, &sc->sc_dmap)) {
printf(": can't create DMA map.\n");
bus_dmamem_unmap(sc->sc_dmat, (void *)sc->sc_buf,
AUDIO_BUF_SIZE);
@@ -241,7 +250,7 @@
return;
}
if (bus_dmamap_load(sc->sc_dmat, sc->sc_dmap, sc->sc_buf,
- AUDIO_BUF_SIZE, NULL, BUS_DMA_NOWAIT)) {
+ AUDIO_BUF_SIZE, NULL, BUS_DMA_WAITOK)) {
printf(": can't load DMA map.\n");
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmap);
bus_dmamem_unmap(sc->sc_dmat, (void *)sc->sc_buf,
@@ -626,6 +635,9 @@
DPRINTFN(2, ("vraiu_intr"));
sc = self;
+
+ mutex_spin_enter(&sc->sc_intr_lock);
+
vrip_intr_setmask2(sc->sc_vrip, sc->sc_handler, AIUINT_INTSEND, 0);
vrip_intr_getstatus2(sc->sc_vrip, sc->sc_handler, ®);
if (reg & AIUINT_INTSEND) {
@@ -639,6 +651,9 @@
bus_space_write_2(sc->sc_iot, sc->sc_ioh, INT_REG_W, SENDINTR);
}
DPRINTFN(2, ("\n"));
+
+ mutex_spin_exit(&sc->sc_intr_lock);
+
return 0;
}
@@ -757,6 +772,18 @@
return 0;
}
+void
+vraiu_get_locks(void *self, kmutex_t **intr, kmutex_t **thread)
+{
+ struct vraiu_softc *sc;
+
+ DPRINTFN(3, ("vraiu_get_locks\n"));
+ sc = self;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
unsigned char mulaw_to_lin[] = {
0x02, 0x06, 0x0a, 0x0e, 0x12, 0x16, 0x1a, 0x1e,
0x22, 0x26, 0x2a, 0x2e, 0x32, 0x36, 0x3a, 0x3e,
Home |
Main Index |
Thread Index |
Old Index