summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2006-04-04 11:45:41 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2006-04-04 11:45:41 +0000
commit0ab07f09d421dd74f6a0ddec4ab448983d9942f6 (patch)
tree49e13ead54217a757cfdd99fc463a7b07f7a4ca0
parentd478432a46ddfbde8d95d6b2bde24a4d62eefb74 (diff)
Add input routines to the i2s layer to support future Zaurus audio input.
ok robert@
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2s.c30
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2s.h4
2 files changed, 32 insertions, 2 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_i2s.c b/sys/arch/arm/xscale/pxa2x0_i2s.c
index e00d58deae7..e4baef152fb 100644
--- a/sys/arch/arm/xscale/pxa2x0_i2s.c
+++ b/sys/arch/arm/xscale/pxa2x0_i2s.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_i2s.c,v 1.6 2006/04/04 09:16:15 pascoe Exp $ */
+/* $OpenBSD: pxa2x0_i2s.c,v 1.7 2006/04/04 11:45:40 pascoe Exp $ */
/*
* Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
@@ -316,3 +316,31 @@ pxa2x0_i2s_start_output(struct pxa2x0_i2s_softc *sc, void *block, int bsize,
return 0;
}
+
+int
+pxa2x0_i2s_start_input(struct pxa2x0_i2s_softc *sc, void *block, int bsize,
+ void (*intr)(void *), void *intrarg)
+{
+ struct pxa2x0_i2s_dma *p;
+ int offset;
+
+ /* Find mapping which contains block completely */
+ for (p = sc->sc_dmas; p && (((caddr_t)block < p->addr) ||
+ ((caddr_t)block + bsize > p->addr + p->size)); p = p->next)
+ ; /* Nothing */
+
+ if (!p) {
+ printf("pxa2x0_i2s_start_input: request with bad start "
+ "address: %p, size: %d)\n", block, bsize);
+ return ENXIO;
+ }
+
+ /* Offset into block to use in mapped block */
+ offset = (caddr_t)block - p->addr;
+
+ /* Start DMA */
+ pxa2x0_dma_from_fifo(2, 2, 0x40400080, 4, 32,
+ p->map->dm_segs[0].ds_addr + offset, bsize, intr, intrarg);
+
+ return 0;
+}
diff --git a/sys/arch/arm/xscale/pxa2x0_i2s.h b/sys/arch/arm/xscale/pxa2x0_i2s.h
index b5c0380bdb3..09aed24746d 100644
--- a/sys/arch/arm/xscale/pxa2x0_i2s.h
+++ b/sys/arch/arm/xscale/pxa2x0_i2s.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_i2s.h,v 1.2 2005/05/26 03:52:07 pascoe Exp $ */
+/* $OpenBSD: pxa2x0_i2s.h,v 1.3 2006/04/04 11:45:40 pascoe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -52,5 +52,7 @@ size_t pxa2x0_i2s_round_buffersize(void *, int, size_t);
int pxa2x0_i2s_start_output(struct pxa2x0_i2s_softc *, void *, int,
void (*)(void *), void *);
+int pxa2x0_i2s_start_input(struct pxa2x0_i2s_softc *, void *, int,
+ void (*)(void *), void *);
#endif