]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/commitdiff
spi: qspi with local edma: move global address translation to test application REL.CORESDK.07.00.00.18 REL.CORESDK.07.00.00.19
authorHongmei Gou <hgou@ti.com>
Wed, 27 May 2020 13:19:50 +0000 (09:19 -0400)
committerSivaraj R <sivaraj@ti.com>
Thu, 28 May 2020 15:57:29 +0000 (10:57 -0500)
Signed-off-by: Hongmei Gou <hgou@ti.com>
packages/ti/drv/spi/soc/dma/v3/QSPI_dma.c
packages/ti/drv/spi/test/qspi_flash/src/main_qspi_flash_test.c

index 157a7bacf10af9994db1a96ee708eff2079417b6..efe9ea08cde65e43544b58315420362e129e364a 100644 (file)
@@ -228,53 +228,6 @@ static int32_t QSPI_edmaChannelConfig(EDMA_Handle hEdma,
     return status;
 }
 
-/**
- *  @b Description
- *  @n
- *      Utility function which converts a local GEM L2 memory address
- *      to global memory address.
- *
- *  @param[in]  addr
- *      Local address to be converted
- *
- *  @retval
- *      Computed L2 global Address
- */
-static uintptr_t l2_global_address (uintptr_t addr)
-{
-#if defined (SOC_TPR12)
-    #ifdef _TMS320C6X
-        if ((addr>=0x00800000 && addr<=0x00860000) || (addr>=0x00F00000 && addr<=0x00F08000))
-        {
-            return (addr | 0x80000000);
-        }
-        else
-        {
-            return (addr);
-        }
-    #else
-        if(addr < 0x80000)
-        {
-            return (addr | 0xC1000000);
-        }
-        else if (addr < 0x100000)
-        {
-            return ((addr & 0xFFFF) | 0xC1800000);
-        }
-        else if ((addr >= 0x10200000) && (addr <= 0x102F0000))
-        {
-            return((addr & 0x00FFFFFF) | 0xC0000000);
-        }
-        else
-        {
-            return (addr);
-        }
-    #endif
-#else
-    return addr;
-#endif
-}
-
 static int32_t QSPI_dmaMemcpy(SPI_Handle     handle,
                               uintptr_t      destBuf,
                               uintptr_t      srcBuf,
@@ -294,10 +247,10 @@ static int32_t QSPI_dmaMemcpy(SPI_Handle     handle,
     QSPI_edmaParamInit(&paramSet.paramSetConfig, hwAttrs->edmaChId, EDMA3_SYNC_AB);
 
     /* Set source address */
-    paramSet.paramSetConfig.sourceAddress = (uint32_t)l2_global_address(srcBuf);
+    paramSet.paramSetConfig.sourceAddress = (uint32_t)srcBuf;
 
     /* set destination address */
-    paramSet.paramSetConfig.destinationAddress = (uint32_t)l2_global_address(destBuf);
+    paramSet.paramSetConfig.destinationAddress = (uint32_t)destBuf;
 
     /* aCount holds the number of bytes in an array. */
     paramSet.paramSetConfig.aCount = (uint16_t)1;
index 0a9424a8c34bd4d91b18d39c28bec12e2f50ffd5..d9a5f59af4229d6a41d5c4f817ac294d2162ed3f 100755 (executable)
@@ -261,6 +261,54 @@ static void QSPI_initConfig(uint32_t instance, QSPI_Tests *test)
     }
 }
 
+/**
+ *  @b Description
+ *  @n
+ *      Utility function which converts a local GEM L2 memory address
+ *      to global memory address.
+ *
+ *  @param[in]  addr
+ *      Local address to be converted
+ *
+ *  @retval
+ *      Computed L2 global Address
+ */
+#ifdef SPI_DMA_ENABLE
+static uintptr_t l2_global_address (uintptr_t addr)
+{
+#if defined (SOC_TPR12)
+    #ifdef _TMS320C6X
+        if ((addr>=0x00800000 && addr<=0x00860000) || (addr>=0x00F00000 && addr<=0x00F08000))
+        {
+            return (addr | 0x80000000);
+        }
+        else
+        {
+            return (addr);
+        }
+    #else
+        if(addr < 0x80000)
+        {
+            return (addr | 0xC1000000);
+        }
+        else if (addr < 0x100000)
+        {
+            return ((addr & 0xFFFF) | 0xC1800000);
+        }
+        else if ((addr >= 0x10200000) && (addr <= 0x102F0000))
+        {
+            return((addr & 0x00FFFFFF) | 0xC0000000);
+        }
+        else
+        {
+            return (addr);
+        }
+    #endif
+#else
+    return addr;
+#endif
+}
+#endif
 
 static bool QSPI_test_func (void *arg)
 {
@@ -321,8 +369,18 @@ static bool QSPI_test_func (void *arg)
             CacheP_wbInv((void *)txBuf, (int32_t)sizeof(txBuf));
         }
 #endif
+
         /* Update transaction parameters */
-        flashTransaction.data        = (uint8_t *)&txBuf[0];
+#ifdef SPI_DMA_ENABLE
+        if (test->dmaMode)
+        {
+            flashTransaction.data    = (uint8_t *)l2_global_address((uintptr_t)&txBuf[0]);
+        }
+        else
+#endif
+        {
+            flashTransaction.data    = (uint8_t *)&txBuf[0];
+        }
 
         if (test->mmapMode)
         {
@@ -347,7 +405,17 @@ static bool QSPI_test_func (void *arg)
         }
 
         /* Update transaction parameters */
-        flashTransaction.data        = (uint8_t *)&rxBuf[0];
+#ifdef SPI_DMA_ENABLE
+        if (test->dmaMode)
+        {
+            flashTransaction.data    = (uint8_t *)l2_global_address((uintptr_t)&rxBuf[0]);
+        }
+        else
+#endif
+        {
+            flashTransaction.data    = (uint8_t *)&rxBuf[0];
+        }
+
         if (test->mmapMode)
         {
             flashTransaction.address = addrValue;