summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-31 19:14:24 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-31 19:14:24 -0600
commit6cd6f015dd4b82840e555e5749a03033ca0383b9 (patch)
tree9a29827f2a6b390e095b739c2b6cfda9c56abf96
parentbc83d262f09e8bafa77af4e2565823760a723474 (diff)
downloadnuttx-6cd6f015dd4b82840e555e5749a03033ca0383b9.tar.gz
nuttx-6cd6f015dd4b82840e555e5749a03033ca0383b9.tar.bz2
nuttx-6cd6f015dd4b82840e555e5749a03033ca0383b9.zip
SAMA5D SSC: Needs to account for data offset in audio buffer.
-rw-r--r--nuttx/arch/arm/src/sama5/sam_ssc.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_ssc.c b/nuttx/arch/arm/src/sama5/sam_ssc.c
index ca7917438..e7c0cb0a8 100644
--- a/nuttx/arch/arm/src/sama5/sam_ssc.c
+++ b/nuttx/arch/arm/src/sama5/sam_ssc.c
@@ -1182,7 +1182,8 @@ static int ssc_rxdma_setup(struct sam_ssc_s *priv)
/* No data received yet */
- apb->nbytes = 0;
+ apb->nbytes = 0;
+ apb->curbyte = 0;
/* Physical address of the SSC RHR register and of the buffer location
* in RAM.
@@ -1551,9 +1552,11 @@ static int ssc_txdma_setup(struct sam_ssc_s *priv)
{
struct sam_buffer_s *bfcontainer;
struct ap_buffer_s *apb;
+ uintptr_t samp;
uintptr_t paddr;
uintptr_t maddr;
uint32_t timeout;
+ apb_samp_t nbytes;
bool notimeout;
int ret;
@@ -1592,17 +1595,21 @@ static int ssc_txdma_setup(struct sam_ssc_s *priv)
apb = bfcontainer->apb;
DEBUGASSERT(((uintptr_t)apb->samp & 3) == 0);
+ /* Get the transfer information, accounting for any data offset */
+
+ samp = (uintptr_t)&apb->samp[apb->curbyte];
+ nbytes = apb->nbytes - apb->curbyte;
+
/* Physical address of the SSC THR register and of the buffer location
- * in
- * RAM.
+ * in RAM.
*/
paddr = ssc_physregaddr(priv, SAM_SSC_THR_OFFSET);
- maddr = sam_physramaddr((uintptr_t)apb->samp);
+ maddr = sam_physramaddr(samp);
/* Configure the TX DMA */
- sam_dmatxsetup(priv->tx.dma, paddr, maddr, apb->nbytes);
+ sam_dmatxsetup(priv->tx.dma, paddr, maddr, nbytes);
/* Increment the DMA timeout */
@@ -1623,9 +1630,7 @@ static int ssc_txdma_setup(struct sam_ssc_s *priv)
* before starting the DMA.
*/
- arch_clean_dcache((uintptr_t)apb->samp,
- (uintptr_t)apb->samp + apb->nbytes);
-
+ arch_clean_dcache(samp, samp + nbytes);
}
#if 1 /* REVISIT: Chained TX transfers */
while (0);