Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys/dev/sbus port to audiomp: update allocm/fre...
details: https://anonhg.NetBSD.org/src/rev/11908e0f5a95
branches: jmcneill-audiomp3
changeset: 771334:11908e0f5a95
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Nov 20 10:48:54 2011 +0000
description:
port to audiomp: update allocm/freem, and add get_locks() support.
bots on my ss20, but i haven't really tested it yet.
diffstat:
sys/dev/sbus/dbri.c | 71 ++++++++++++++++++++++++++-----------------------
sys/dev/sbus/dbrivar.h | 5 ++-
2 files changed, 42 insertions(+), 34 deletions(-)
diffs (158 lines):
diff -r 2e546258bf2e -r 11908e0f5a95 sys/dev/sbus/dbri.c
--- a/sys/dev/sbus/dbri.c Sun Nov 20 10:27:36 2011 +0000
+++ b/sys/dev/sbus/dbri.c Sun Nov 20 10:48:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $ */
+/* $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $ */
/*
* Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33 2011/03/09 05:40:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -43,11 +43,11 @@
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/intr.h>
+#include <sys/kmem.h>
#include <dev/sbus/sbusvar.h>
#include <sparc/sparc/auxreg.h>
@@ -156,9 +156,10 @@
void (*)(void *), void *, const struct audio_params *);
static int dbri_trigger_input(void *, void *, void *, int,
void (*)(void *), void *, const struct audio_params *);
+static void dbri_get_locks(void *, kmutex_t **, kmutex_t **);
-static void *dbri_malloc(void *, int, size_t, struct malloc_type *, int);
-static void dbri_free(void *, void *, struct malloc_type *);
+static void *dbri_malloc(void *, int, size_t);
+static void dbri_free(void *, void *, size_t);
static paddr_t dbri_mappage(void *, void *, off_t, int);
static void dbri_set_power(struct dbri_softc *, int);
static void dbri_bring_up(struct dbri_softc *);
@@ -175,32 +176,25 @@
};
struct audio_hw_if dbri_hw_if = {
- dbri_open,
- dbri_close,
- NULL, /* drain */
- dbri_query_encoding,
- dbri_set_params,
- dbri_round_blocksize,
- NULL, /* commit_settings */
- NULL, /* init_output */
- NULL, /* init_input */
- NULL, /* start_output */
- NULL, /* start_input */
- dbri_halt_output,
- dbri_halt_input,
- NULL, /* speaker_ctl */
- dbri_getdev,
- NULL, /* setfd */
- dbri_set_port,
- dbri_get_port,
- dbri_query_devinfo,
- dbri_malloc,
- dbri_free,
- dbri_round_buffersize,
- dbri_mappage,
- dbri_get_props,
- dbri_trigger_output,
- dbri_trigger_input
+ .open = dbri_open,
+ .close = dbri_close,
+ .query_encoding = dbri_query_encoding,
+ .set_params = dbri_set_params,
+ .round_blocksize = dbri_round_blocksize,
+ .halt_output = dbri_halt_output,
+ .halt_input = dbri_halt_input,
+ .getdev = dbri_getdev,
+ .set_port = dbri_set_port,
+ .get_port = dbri_get_port,
+ .query_devinfo = dbri_query_devinfo,
+ .allocm = dbri_malloc,
+ .freem = dbri_free,
+ .round_buffersize = dbri_round_buffersize,
+ .mappage = dbri_mappage,
+ .get_props = dbri_get_props,
+ .trigger_output = dbri_trigger_output,
+ .trigger_input = dbri_trigger_input,
+ .get_locks = dbri_get_locks,
};
CFATTACH_DECL_NEW(dbri, sizeof(struct dbri_softc),
@@ -370,6 +364,9 @@
sc->sc_dmabase = sc->sc_dmamap->dm_segs[0].ds_addr;
sc->sc_bufsiz = size;
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+
bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr,
sc);
@@ -2049,6 +2046,14 @@
return 0;
}
+static void
+dbri_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread)
+{
+ struct dbri_softc *sc = opaque;
+
+ *intr = &sc->sc_intr_lock;
+ *thread = &sc->sc_lock;
+}
static uint32_t
reverse_bytes(uint32_t b, int len)
@@ -2075,7 +2080,7 @@
}
static void *
-dbri_malloc(void *v, int dir, size_t s, struct malloc_type *mt, int flags)
+dbri_malloc(void *v, int dir, size_t s)
{
struct dbri_softc *sc = v;
struct dbri_desc *dd = &sc->sc_desc[sc->sc_desc_used];
@@ -2116,7 +2121,7 @@
}
static void
-dbri_free(void *v, void *p, struct malloc_type *mt)
+dbri_free(void *v, void *p, size_t size)
{
struct dbri_softc *sc = v;
struct dbri_desc *dd;
diff -r 2e546258bf2e -r 11908e0f5a95 sys/dev/sbus/dbrivar.h
--- a/sys/dev/sbus/dbrivar.h Sun Nov 20 10:27:36 2011 +0000
+++ b/sys/dev/sbus/dbrivar.h Sun Nov 20 10:48:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbrivar.h,v 1.12 2011/01/11 00:49:50 macallan Exp $ */
+/* $NetBSD: dbrivar.h,v 1.12.10.1 2011/11/20 10:48:54 mrg Exp $ */
/*
* Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -166,6 +166,9 @@
struct audio_params sc_params;
struct dbri_dma *sc_dma;
+
+ kmutex_t sc_lock;
+ kmutex_t sc_intr_lock;
};
#define dbri_dma_off(member, elem) \
Home |
Main Index |
Thread Index |
Old Index