Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-audiomp3]: src/sys/arch port zaudio to audiomp api changes for ...
details: https://anonhg.NetBSD.org/src/rev/614db3a82d6a
branches: jmcneill-audiomp3
changeset: 771359:614db3a82d6a
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 20 13:47:07 2011 +0000
description:
port zaudio to audiomp api changes for real this time
diffstat:
sys/arch/arm/xscale/pxa2x0_ac97.c | 12 ++++----
sys/arch/arm/xscale/pxa2x0_dmac.c | 11 ++++---
sys/arch/arm/xscale/pxa2x0_dmac.h | 4 +-
sys/arch/arm/xscale/pxa2x0_i2s.c | 50 +++++++++++++++++---------------------
sys/arch/arm/xscale/pxa2x0_i2s.h | 7 +++--
sys/arch/arm/xscale/pxa2x0_mci.c | 8 +++---
sys/arch/zaurus/dev/zaudio.c | 28 +++++++--------------
7 files changed, 54 insertions(+), 66 deletions(-)
diffs (truncated from 455 to 300 lines):
diff -r 56ffcb843086 -r 614db3a82d6a sys/arch/arm/xscale/pxa2x0_ac97.c
--- a/sys/arch/arm/xscale/pxa2x0_ac97.c Sun Nov 20 13:31:19 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_ac97.c Sun Nov 20 13:47:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_ac97.c,v 1.9.4.1 2011/11/20 13:13:43 mrg Exp $ */
+/* $NetBSD: pxa2x0_ac97.c,v 1.9.4.2 2011/11/20 13:47:07 jmcneill Exp $ */
/*
* Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -679,28 +679,28 @@
return (NULL);
/* XXX */
- if ((ad->ad_dx = pxa2x0_dmac_allocate_xfer(M_NOWAIT)) == NULL)
+ if ((ad->ad_dx = pxa2x0_dmac_allocate_xfer()) == NULL)
goto error;
ad->ad_size = size;
error = bus_dmamem_alloc(sc->sc_dmat, size, 16, 0, ad->ad_segs,
- ACU_N_SEGS, &ad->ad_nsegs, BUS_DMA_NOWAIT);
+ ACU_N_SEGS, &ad->ad_nsegs, BUS_DMA_WAITOK);
if (error)
goto free_xfer;
error = bus_dmamem_map(sc->sc_dmat, ad->ad_segs, ad->ad_nsegs, size,
- &ad->ad_addr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT | BUS_DMA_NOCACHE);
+ &ad->ad_addr, BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_NOCACHE);
if (error)
goto free_dmamem;
error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ad->ad_map);
+ BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW, &ad->ad_map);
if (error)
goto unmap_dmamem;
error = bus_dmamap_load(sc->sc_dmat, ad->ad_map, ad->ad_addr, size,
- NULL, BUS_DMA_NOWAIT);
+ NULL, BUS_DMA_WAITOK);
if (error) {
bus_dmamap_destroy(sc->sc_dmat, ad->ad_map);
unmap_dmamem: bus_dmamem_unmap(sc->sc_dmat, ad->ad_addr, size);
diff -r 56ffcb843086 -r 614db3a82d6a sys/arch/arm/xscale/pxa2x0_dmac.c
--- a/sys/arch/arm/xscale/pxa2x0_dmac.c Sun Nov 20 13:31:19 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_dmac.c Sun Nov 20 13:47:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_dmac.c,v 1.8 2011/07/01 20:32:51 dyoung Exp $ */
+/* $NetBSD: pxa2x0_dmac.c,v 1.8.4.1 2011/11/20 13:47:07 jmcneill Exp $ */
/*
* Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/queue.h>
#include <uvm/uvm_param.h> /* For PAGE_SIZE */
@@ -741,11 +741,11 @@
#endif
struct dmac_xfer *
-pxa2x0_dmac_allocate_xfer(int flags)
+pxa2x0_dmac_allocate_xfer(void)
{
struct dmac_xfer_state *dxs;
- dxs = malloc(sizeof(struct dmac_xfer_state), M_DEVBUF, flags);
+ dxs = kmem_alloc(sizeof(*dxs), KM_SLEEP);
return ((struct dmac_xfer *)dxs);
}
@@ -753,12 +753,13 @@
void
pxa2x0_dmac_free_xfer(struct dmac_xfer *dx)
{
+ struct dmac_xfer_state *dxs = (struct dmac_xfer_state *)dx;
/*
* XXX: Should verify the DMAC is not actively using this
* structure before freeing...
*/
- free(dx, M_DEVBUF);
+ kmem_free(dxs, sizeof(*dxs));
}
static inline int
diff -r 56ffcb843086 -r 614db3a82d6a sys/arch/arm/xscale/pxa2x0_dmac.h
--- a/sys/arch/arm/xscale/pxa2x0_dmac.h Sun Nov 20 13:31:19 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_dmac.h Sun Nov 20 13:47:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_dmac.h,v 1.3 2007/02/21 22:59:39 thorpej Exp $ */
+/* $NetBSD: pxa2x0_dmac.h,v 1.3.84.1 2011/11/20 13:47:07 jmcneill Exp $ */
/*
* Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -147,7 +147,7 @@
#define DMAC_DESC_DST 1
};
-extern struct dmac_xfer *pxa2x0_dmac_allocate_xfer(int);
+extern struct dmac_xfer *pxa2x0_dmac_allocate_xfer(void);
extern void pxa2x0_dmac_free_xfer(struct dmac_xfer *);
extern int pxa2x0_dmac_start_xfer(struct dmac_xfer *);
extern void pxa2x0_dmac_abort_xfer(struct dmac_xfer *);
diff -r 56ffcb843086 -r 614db3a82d6a sys/arch/arm/xscale/pxa2x0_i2s.c
--- a/sys/arch/arm/xscale/pxa2x0_i2s.c Sun Nov 20 13:31:19 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_i2s.c Sun Nov 20 13:47:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_i2s.c,v 1.9 2011/07/01 20:32:51 dyoung Exp $ */
+/* $NetBSD: pxa2x0_i2s.c,v 1.9.4.1 2011/11/20 13:47:07 jmcneill Exp $ */
/* $OpenBSD: pxa2x0_i2s.c,v 1.7 2006/04/04 11:45:40 pascoe Exp $ */
/*
@@ -18,13 +18,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_i2s.c,v 1.9 2011/07/01 20:32:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_i2s.c,v 1.9.4.1 2011/11/20 13:47:07 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/malloc.h>
-
+#include <sys/kmem.h>
#include <sys/bus.h>
#include <arm/xscale/pxa2x0reg.h>
@@ -67,6 +66,8 @@
{
int rv;
+ KASSERT(sc->sc_intr_lock != NULL);
+
rv = bus_space_map(sc->sc_iot, PXA2X0_I2S_BASE, PXA2X0_I2S_SIZE, 0,
&sc->sc_ioh);
if (rv) {
@@ -191,19 +192,18 @@
}
void *
-pxa2x0_i2s_allocm(void *hdl, int direction, size_t size,
- struct malloc_type *type, int flags)
+pxa2x0_i2s_allocm(void *hdl, int direction, size_t size)
{
struct pxa2x0_i2s_softc *sc = hdl;
struct pxa2x0_i2s_dma *p;
struct dmac_xfer *dx;
int error;
- p = malloc(sizeof(*p), type, flags);
+ p = kmem_alloc(sizeof(*p), KM_SLEEP);
if (p == NULL)
return NULL;
- dx = pxa2x0_dmac_allocate_xfer(M_NOWAIT);
+ dx = pxa2x0_dmac_allocate_xfer();
if (dx == NULL) {
goto fail_alloc;
}
@@ -211,22 +211,22 @@
p->size = size;
if ((error = bus_dmamem_alloc(sc->sc_dmat, size, NBPG, 0, p->segs,
- I2S_N_SEGS, &p->nsegs, BUS_DMA_NOWAIT)) != 0) {
+ I2S_N_SEGS, &p->nsegs, BUS_DMA_WAITOK)) != 0) {
goto fail_xfer;
}
if ((error = bus_dmamem_map(sc->sc_dmat, p->segs, p->nsegs, size,
- &p->addr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) {
+ &p->addr, BUS_DMA_WAITOK | BUS_DMA_COHERENT)) != 0) {
goto fail_map;
}
if ((error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,
- BUS_DMA_NOWAIT, &p->map)) != 0) {
+ BUS_DMA_WAITOK, &p->map)) != 0) {
goto fail_create;
}
if ((error = bus_dmamap_load(sc->sc_dmat, p->map, p->addr, size, NULL,
- BUS_DMA_NOWAIT)) != 0) {
+ BUS_DMA_WAITOK)) != 0) {
goto fail_load;
}
@@ -249,12 +249,12 @@
fail_xfer:
pxa2x0_dmac_free_xfer(dx);
fail_alloc:
- free(p, type);
+ kmem_free(p, sizeof(*p));
return NULL;
}
void
-pxa2x0_i2s_freem(void *hdl, void *ptr, struct malloc_type *type)
+pxa2x0_i2s_freem(void *hdl, void *ptr, size_t size)
{
struct pxa2x0_i2s_softc *sc = hdl;
struct pxa2x0_i2s_dma **pp, *p;
@@ -270,7 +270,7 @@
bus_dmamem_free(sc->sc_dmat, p->segs, p->nsegs);
*pp = p->next;
- free(p, type);
+ kmem_free(p, sizeof(*p));
return;
}
}
@@ -321,14 +321,13 @@
pxa2x0_i2s_halt_output(void *hdl)
{
struct pxa2x0_i2s_softc *sc = hdl;
- int s;
- s = splaudio();
+ mutex_spin_enter(sc->sc_intr_lock);
if (sc->sc_txdma) {
pxa2x0_dmac_abort_xfer(sc->sc_txdma->dx);
sc->sc_txdma = NULL;
}
- splx(s);
+ mutex_spin_exit(sc->sc_intr_lock);
return 0;
}
@@ -337,14 +336,13 @@
pxa2x0_i2s_halt_input(void *hdl)
{
struct pxa2x0_i2s_softc *sc = hdl;
- int s;
- s = splaudio();
+ mutex_spin_enter(sc->sc_intr_lock);
if (sc->sc_rxdma) {
pxa2x0_dmac_abort_xfer(sc->sc_rxdma->dx);
sc->sc_rxdma = NULL;
}
- splx(s);
+ mutex_spin_exit(sc->sc_intr_lock);
return 0;
}
@@ -453,7 +451,6 @@
pxa2x0_i2s_dmac_ointr(struct dmac_xfer *dx, int status)
{
struct pxa2x0_i2s_softc *sc = dx->dx_cookie;
- int s;
if (sc->sc_txdma == NULL) {
panic("pxa2x_i2s_dmac_ointr: bad TX DMA descriptor!");
@@ -468,16 +465,15 @@
"non-zero completion status %d\n", status);
}
- s = splaudio();
+ mutex_spin_enter(sc->sc_intr_lock);
(sc->sc_txfunc)(sc->sc_txarg);
- splx(s);
+ mutex_spin_exit(sc->sc_intr_lock);
}
static void
pxa2x0_i2s_dmac_iintr(struct dmac_xfer *dx, int status)
{
struct pxa2x0_i2s_softc *sc = dx->dx_cookie;
- int s;
if (sc->sc_rxdma == NULL) {
panic("pxa2x_i2s_dmac_iintr: bad RX DMA descriptor!");
@@ -493,7 +489,7 @@
}
- s = splaudio();
+ mutex_spin_enter(sc->sc_intr_lock);
(sc->sc_rxfunc)(sc->sc_rxarg);
- splx(s);
+ mutex_spin_exit(sc->sc_intr_lock);
}
diff -r 56ffcb843086 -r 614db3a82d6a sys/arch/arm/xscale/pxa2x0_i2s.h
--- a/sys/arch/arm/xscale/pxa2x0_i2s.h Sun Nov 20 13:31:19 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_i2s.h Sun Nov 20 13:47:07 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_i2s.h,v 1.2 2011/07/01 20:32:51 dyoung Exp $ */
+/* $NetBSD: pxa2x0_i2s.h,v 1.2.4.1 2011/11/20 13:47:07 jmcneill Exp $ */
/* $OpenBSD: pxa2x0_i2s.h,v 1.3 2006/04/04 11:45:40 pascoe Exp $ */
/*
@@ -27,6 +27,7 @@
struct pxa2x0_i2s_softc {
struct device sc_dev;
Home |
Main Index |
Thread Index |
Old Index