Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys/arch/amiga/dev port these to audiomp: suppo...
details: https://anonhg.NetBSD.org/src/rev/27aac3986bfe
branches: jmcneill-audiomp3
changeset: 771351:27aac3986bfe
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Nov 20 12:41:59 2011 +0000
description:
port these to audiomp: support get_locks, and take the intr_lock
in the interrupt handler.
diffstat:
sys/arch/amiga/dev/aucc.c | 31 +++++++++++++++++++++++--------
sys/arch/amiga/dev/toccata.c | 34 +++++++++++++++++++++++++++++++---
2 files changed, 54 insertions(+), 11 deletions(-)
diffs (212 lines):
diff -r fc7b8e6ad789 -r 27aac3986bfe sys/arch/amiga/dev/aucc.c
--- a/sys/arch/amiga/dev/aucc.c Sun Nov 20 12:37:56 2011 +0000
+++ b/sys/arch/amiga/dev/aucc.c Sun Nov 20 12:41:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aucc.c,v 1.40 2006/03/08 23:46:22 lukem Exp $ */
+/* $NetBSD: aucc.c,v 1.40.104.1 2011/11/20 12:41:59 mrg Exp $ */
/*
* Copyright (c) 1999 Bernardo Innocenti
@@ -53,7 +53,7 @@
#if NAUCC > 0
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.40 2006/03/08 23:46:22 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.40.104.1 2011/11/20 12:41:59 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -91,12 +91,6 @@
#define DPRINTF(x)
#endif
-#ifdef splaudio
-#undef splaudio
-#endif
-
-#define splaudio() spl4();
-
/* clock frequency.. */
extern int eclockfreq;
@@ -122,6 +116,9 @@
int sc_channelmask; /* which channels are used ? */
void (*sc_decodefunc)(u_char **, u_char *, int);
/* pointer to format conversion routine */
+
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
};
/* interrupt interfaces */
@@ -205,6 +202,7 @@
int aucc_set_params(void *, int, int, audio_params_t *, audio_params_t *,
stream_filter_list_t *, stream_filter_list_t *);
int aucc_get_props(void *);
+void aucc_get_locks(void *, kmutex_t **, kmutex_t **);
static void aucc_decode_slinear8_1ch(u_char **, u_char *, int);
@@ -262,6 +260,8 @@
NULL,
NULL,
NULL,
+ NULL,
+ aucc_get_locks,
};
/* autoconfig routines */
@@ -343,6 +343,9 @@
custom.intena = AUCC_ALLINTF;
custom.dmacon = AUCC_ALLDMAF;
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+
return err;
}
@@ -907,6 +910,16 @@
return 0;
}
+
+void
+aucc_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct aucc_softc *sc = opaque;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
int
aucc_query_devinfo(void *addr, register mixer_devinfo_t *dip)
{
@@ -958,6 +971,7 @@
int i;
int mask;
+ mutex_spin_enter(&aucc->sc_intr_lock);
mask = aucc->sc_channel[ch].nd_mask;
/*
* for all channels in this maskgroup:
@@ -991,6 +1005,7 @@
(aucc->sc_channel[ch].nd_intrdata);
} else
DPRINTF(("zero int handler\n"));
+ mutex_spin_exit(&aucc->sc_intr_lock);
DPRINTF(("ints done\n"));
}
diff -r fc7b8e6ad789 -r 27aac3986bfe sys/arch/amiga/dev/toccata.c
--- a/sys/arch/amiga/dev/toccata.c Sun Nov 20 12:37:56 2011 +0000
+++ b/sys/arch/amiga/dev/toccata.c Sun Nov 20 12:41:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: toccata.c,v 1.14 2011/07/19 15:55:27 dyoung Exp $ */
+/* $NetBSD: toccata.c,v 1.14.4.1 2011/11/20 12:41:59 mrg Exp $ */
/*-
* Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.14 2011/07/19 15:55:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.14.4.1 2011/11/20 12:41:59 mrg Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -174,6 +174,8 @@
int toccata_get_port(void *, mixer_ctrl_t *);
int toccata_query_devinfo(void *, mixer_devinfo_t *);
+void toccata_get_locks(void *, kmutex_t **, kmutex_t **);
+
const struct audio_hw_if audiocs_hw_if = {
toccata_open,
toccata_close,
@@ -205,6 +207,9 @@
toccata_get_props,
0, /* trigger_output */
0,
+ 0,
+ 0,
+ toccata_get_locks,
};
struct toccata_softc {
@@ -219,6 +224,9 @@
void (*sc_playmore)(void *);
void *sc_playarg;
+
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
};
int toccata_match(device_t, cfdata_t, void *);
@@ -275,6 +283,9 @@
sc->sc_captbuf = 0;
sc->sc_playmore = 0;
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+
sc->sc_isr.isr_ipl = 6;
sc->sc_isr.isr_arg = sc;
sc->sc_isr.isr_intr = toccata_intr;
@@ -294,14 +305,20 @@
int i;
sc = tag;
+
+ mutex_spin_enter(&sc->sc_intr_lock);
+
status = *(sc->sc_boardp);
- if (status & TOCC_FIFO_INT) /* active low */
+ if (status & TOCC_FIFO_INT) { /* active low */
+ mutex_spin_exit(&sc->sc_intr_lock);
return 0;
+ }
if (status & TOCC_FIFO_PBHE) {
if (sc->sc_playmore) {
(*sc->sc_playmore)(sc->sc_playarg);
+ mutex_spin_exit(&sc->sc_intr_lock);
return 1;
}
} else if (status & TOCC_FIFO_CPHF) {
@@ -318,6 +335,7 @@
/* XXX if (sc->sc_captmore) { */
(*sc->sc_captmore)(sc->sc_captarg);
+ mutex_spin_exit(&sc->sc_intr_lock);
return 1;
}
}
@@ -333,6 +351,7 @@
device_xname(sc->sc_ad.sc_dev), status);
#endif
*sc->sc_boardp = TOCC_ACT;
+ mutex_spin_exit(&sc->sc_intr_lock);
return 1;
}
@@ -442,6 +461,15 @@
return 0;
}
+void
+toccata_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct toccata_softc *sc = opaque;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
+
int
toccata_halt_input(void *addr)
{
Home |
Main Index |
Thread Index |
Old Index